Skip to content

Commit bf57cb4

Browse files
authored
DOCSP-47211-default-sort-order-setting (#724)
* DOCSP-47211-default-sort-order-setting * DOCSP-47211-default-sort-order-setting * DOCSP-47211-default-sort-order-setting * DOCSP-47211-default-sort-order-setting * DOCSP-47211-default-sort-order-setting * DOCSP-47211 copy edits * DOCSP-47211 t3ech edit * DOCSP-47211 tech edit * DOCSP-47211 tech edit
1 parent 24d4b32 commit bf57cb4

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

source/query/sort.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Sort the Returned Documents
1616
If the query bar displays the :guilabel:`Sort` option, you can specify
1717
the 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

2127
Compatibility

source/settings.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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>

source/settings/set-default-sort.txt

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+

source/settings/settings-reference.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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|

0 commit comments

Comments
 (0)