Docs Menu
Docs Home
/
MongoDB Compass
/

Set Default Sort Order

On this page

  • About This Task
  • Procedure
  • To open the MongoDB Compass Settings Panel, click the gear icon on the left column of the Compass home screen.
  • Open the Default Sort for Query Bar dropdown menu.
  • Select the default sort order you would like to use.
  • Click Save.

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

$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

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