Docs Menu
Docs Home
/ /

Set Default Sort Order

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.

You can choose one of the following default sort options:

Sort Key
Description

MongoDB server default

Sort in the natural order of documents

_id: 1

Sort in ascending order by the _id field

_id: -1

Sort in descending order by the _id field

$natural: -1

Sort in reverse natural order of documents, but ignore existing indexes.

WARNING: Only use this option with development clusters.

Note

The default sort option you select does not apply to views or time series collections.

1
Settings gear icon location on MongoDB Compass UI

Alternatively, you can use keyboard shortcuts to open the Settings panel:

  • Windows / Linux: Ctrl + ,

  • Mac: + ,

Compass opens a dialog box where you can configure your MongoDB Compass settings.

2
3
4

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.

Back

Block Outgoing Connections

On this page