Docs Menu
Docs Home
/
Database Manual
/ / / /

$natural

$natural

The $natural operator controls the order in which documents are returned from a collection. $natural orders documents based on their physical order on disk rather than the order defined by an index.

The natural order typically uses the order in which MongoDB inserts documents into the database. The order is not guaranteed because of potential document relocations.

Use in conjunction with cursor.hint() to perform a collection scan to return documents in natural order.

For usage, see Force Collection Scans example in the cursor.hint() reference page.

$natural provides access to the underlying document order on disk. However, you should typically use explicit field sorting.

You can specify a $natural sort when running a find operation against a view.

Back

Miscellaneous