File tree Expand file tree Collapse file tree 4 files changed +81
-0
lines changed Expand file tree Collapse file tree 4 files changed +81
-0
lines changed 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 the :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 @@ -67,6 +67,7 @@ Learn more
6767 Command Line Options </settings/command-line-options>
6868 Configuration File Settings </settings/config-file>
6969 Block Outgoing Connections </settings/restrict-outgoing-connections>
70+ Set Default Sort Order </settings/set-default-sort>
7071 Show Kerberos Password </settings/show-kerberos-password>
7172 Hide Credentials </settings/protect-connection-strings>
7273 Block Write Operations </settings/read-only>
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+ .. contents:: On this page
8+ :local:
9+ :backlinks: none
10+ :depth: 2
11+ :class: singlecol
12+
13+ You can specify a default sort order for documents shown in Compass through the
14+ :guilabel:`Settings` panel.
15+
16+ .. note::
17+
18+ If you specify a sort order through a query in the Query Bar, the sort order
19+ that you specify in the query overrides the default sort order.
20+
21+ If you :ref:`save a query <compass-favorite-queries>`, Compass does not save
22+ the default sort order as part of the saved query.
23+
24+ About This Task
25+ ---------------
26+
27+ You can choose one of the following default sort options:
28+
29+ .. list-table::
30+ :header-rows: 1
31+ :stub-columns: 1
32+ :widths: 20 80
33+
34+ * - Sort Key
35+ - Description
36+
37+ * - $natural: 1
38+ - Sort in the natural order of documents
39+
40+ * - $natural: -1
41+ - Sort in reverse natural order of documents
42+
43+ * - _id: 1
44+ - Sort in ascending order by the ``_id`` field
45+
46+ * - _id: -1
47+ - Sort in descending order by the ``_id`` field
48+
49+ Procedure
50+ ---------
51+
52+ .. procedure::
53+ :style: normal
54+
55+ .. include:: includes/fact-navigate-to-settings.rst
56+
57+ .. step:: Open the :guilabel:`Default Sort for Query Bar` dropdown menu.
58+
59+ .. step:: Select the default sort order you would like to use.
60+
61+ .. step:: Click :guilabel:`Save`.
62+
63+ .. note::
64+
65+ If you do not specify a default sort order, Compass uses the MongoDB server
66+ default sort order of ``$natural: 1``, unless otherwise specified in the
67+ Query Bar.
68+
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 Compass sorts documents.
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