Set Default Sort Order
On this page
You can specify a default sort order for documents shown in Compass through the 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 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:
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: -1 | Sort in descending order by the |
Procedure
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.