Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions source/query/sort.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Sort the Returned Documents
If the query bar displays the :guilabel:`Sort` option, you can specify
the sort order of the returned documents.

.. note::

If you specify a sort order in the Query Bar, the specified sort order
overrides the :ref:`default sort order <compass-sort-query-bar>` you set
in :guilabel:`Settings`.

.. BEGIN-COMPASS-ONLY

Compatibility
Expand Down
1 change: 1 addition & 0 deletions source/settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Learn more
Command Line Options </settings/command-line-options>
Configuration File Settings </settings/config-file>
Block Outgoing Connections </settings/restrict-outgoing-connections>
Set Default Sort Order </settings/set-default-sort>
Show Kerberos Password </settings/show-kerberos-password>
Hide Credentials </settings/protect-connection-strings>
Block Write Operations </settings/read-only>
Expand Down
68 changes: 68 additions & 0 deletions source/settings/set-default-sort.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.. _compass-sort-query-bar:

======================
Set Default Sort Order
======================

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol

You can specify a default sort order for documents shown in Compass through the
:guilabel:`Settings` panel.

.. note::

If you specify a sort order through a query in the Query Bar, the sort order
that you specify in the query overrides the default sort order.

If you :ref:`save a query <compass-favorite-queries>`, Compass does not save
the default sort order as part of the saved query.

About This Task
---------------

You can choose one of the following default sort options:

.. list-table::
:header-rows: 1
:stub-columns: 1
:widths: 20 80
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: We don't use it widely, but with these sort of lexical reference tables the :stub-columns: 1 option sometimes helps with formatting for clarity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


* - Sort Key
- Description

* - $natural: 1
- Sort in the natural order of documents

* - $natural: -1
- Sort in reverse natural order of documents

* - _id: 1
- Sort in ascending order by the ``_id`` field

* - _id: -1
- Sort in descending order by the ``_id`` field

Procedure
---------

.. procedure::
:style: normal

Check failure on line 53 in source/settings/set-default-sort.txt

View workflow job for this annotation

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.Accessibility] Don't use language (such as 'normal') that defines people by their disability. Raw Output: {"message": "[MongoDB.Accessibility] Don't use language (such as 'normal') that defines people by their disability.", "location": {"path": "source/settings/set-default-sort.txt", "range": {"start": {"line": 53, "column": 12}}}, "severity": "ERROR"}

.. include:: includes/fact-navigate-to-settings.rst

.. step:: Open the :guilabel:`Default Sort for Query Bar` dropdown menu.

.. step:: Select the default sort order you would like to use.

Check failure on line 59 in source/settings/set-default-sort.txt

View workflow job for this annotation

GitHub Actions / TDBX Vale rules

[vale] reported by reviewdog 🐶 [MongoDB.AvoidSubjunctive] Avoid the subjunctive 'would'. Raw Output: {"message": "[MongoDB.AvoidSubjunctive] Avoid the subjunctive 'would'.", "location": {"path": "source/settings/set-default-sort.txt", "range": {"start": {"line": 59, "column": 48}}}, "severity": "ERROR"}

.. step:: Click :guilabel:`Save`.

.. note::

If you do not specify a default sort order, Compass uses the MongoDB server
default sort order of ``$natural: 1``, unless otherwise specified in the
Query Bar.

6 changes: 6 additions & 0 deletions source/settings/settings-reference.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ You can configure the following settings on the |compass| interface:

To learn more, see :ref:`compass-protect-connection-strings`.

* - Default Sort for Query Bar
- General
- Defines how Compass sorts documents.

To learn more, see :ref:`compass-sort-query-bar`.

* - Show Kerberos Password Field
- General
- Show or hide the Kerberos password field on the |compass-short|
Expand Down
Loading