diff --git a/source/query/sort.txt b/source/query/sort.txt index 7f4feebf7..9f52fcb69 100644 --- a/source/query/sort.txt +++ b/source/query/sort.txt @@ -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 ` you set + in :guilabel:`Settings`. + .. BEGIN-COMPASS-ONLY Compatibility diff --git a/source/settings.txt b/source/settings.txt index a687cd848..aa155792f 100644 --- a/source/settings.txt +++ b/source/settings.txt @@ -67,6 +67,7 @@ Learn more Command Line Options Configuration File Settings Block Outgoing Connections + Set Default Sort Order Show Kerberos Password Hide Credentials Block Write Operations diff --git a/source/settings/set-default-sort.txt b/source/settings/set-default-sort.txt new file mode 100644 index 000000000..ce7cab183 --- /dev/null +++ b/source/settings/set-default-sort.txt @@ -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 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 + + * - 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 + + .. 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. + + .. 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. + diff --git a/source/settings/settings-reference.txt b/source/settings/settings-reference.txt index 797b67ca1..45ed2a5d3 100644 --- a/source/settings/settings-reference.txt +++ b/source/settings/settings-reference.txt @@ -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|