File tree Expand file tree Collapse file tree 3 files changed +74
-0
lines changed Expand file tree Collapse file tree 3 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ .. _compass-sort-query-bar:
2+
3+ ======================
4+ Set Default Sort Order
5+ ======================
6+
7+ .. default-domain:: mongodb
8+
9+ .. contents:: On this page
10+ :local:
11+ :backlinks: none
12+ :depth: 2
13+ :class: singlecol
14+
15+ You can specify a default sort order documents that operations in the
16+ :ref:`query bar <compass-query-bar>` return. If you do not explicitly
17+ :ref:`specify a sort order in the query bar <compass-query-bar-sort>`, Compass
18+ applies the default sort order specified in the :guilabel:`Settings` panel.
19+
20+ About This Task
21+ ---------------
22+
23+ You can choose 1 of the following default sort options:
24+
25+ .. list-table::
26+ :header-rows: 1
27+ :widths: 20 80
28+
29+ * - Sort Key
30+ - Description
31+
32+ * - $natural: 1
33+ - Sort in the natural order of documents
34+
35+ * - $natural: -1
36+ - Sort in reverse natural order of documents
37+
38+ * - _id: 1
39+ - Sort in ascending order by the ``_id`` field
40+
41+ * - _id: -1
42+ - Sort in descending order by the ``_id`` field
43+
44+ Procedure
45+ ---------
46+
47+ .. procedure::
48+ :style: normal
49+
50+ .. include:: includes/fact-navigate-to-settings.rst
51+
52+ .. step:: Open the :guilabel:`Default Sort for Query Bar` dropdown menu.
53+
54+ .. step:: Select the default sort order you would like to use.
55+
56+ .. step:: Click :guilabel:`Save`.
57+
58+ .. note::
59+
60+ If you do not specify a default sort order, Compass uses the MongoDB server
61+ default sort order of ``$natural: 1``.
62+
Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ Sort the Returned Documents
1616If the query bar displays the :guilabel:`Sort` option, you can specify
1717the sort order of the returned documents.
1818
19+ .. note::
20+
21+ If you specify a sort order in the query bar, the specified sort order
22+ overrides any :ref:`default sort order <compass-sort-query-bar>` you set
23+ in :guilabel:`Settings`.
24+
1925.. BEGIN-COMPASS-ONLY
2026
2127Compatibility
Original file line number Diff line number Diff line change @@ -79,6 +79,12 @@ You can configure the following settings on the |compass| interface:
7979
8080 To learn more, see :ref:`compass-protect-connection-strings`.
8181
82+ * - Default Sort for Query Bar
83+ - General
84+ - Defines how queries executed from the query bar sort results
85+
86+ To learn more, see :ref:`compass-sort-query-bar`.
87+
8288 * - Show Kerberos Password Field
8389 - General
8490 - Show or hide the Kerberos password field on the |compass-short|
You can’t perform that action at this time.
0 commit comments