diff --git a/source/reference/glossary.txt b/source/reference/glossary.txt index 419bc1d3e00..2c900be680c 100644 --- a/source/reference/glossary.txt +++ b/source/reference/glossary.txt @@ -463,11 +463,17 @@ Glossary management. natural order - The order in which a database stores documents on disk. - Typically this order is the same as the - insertion order. :term:`Capped collections `, - among other things, guarantee that insertion order and natural - order are identical. + The order in which a database stores documents on disk. Typically + this order is the same as the insertion order, though it is not + guaranteed to be. :term:`Capped collections ` + guarantee that insertion order and natural order are identical. + + When you execute :method:`find() ` with no + parameters, the database returns documents in forward natural + order. When you execute :method:`find() ` + and include :method:`sort() ` with a parameter of + ``$natural:-1``, the database returns documents in reverse natural + order. primary key A record's unique, immutable identifier. In an :term:`RDBMS`, the primary diff --git a/source/reference/method/cursor.sort.txt b/source/reference/method/cursor.sort.txt index 3978fce2063..f886f994a51 100644 --- a/source/reference/method/cursor.sort.txt +++ b/source/reference/method/cursor.sort.txt @@ -47,3 +47,13 @@ cursor.sort() than 32 megabytes, MongoDB will return an error. Use :method:`cursor.limit()`, or create an index on the field that you're sorting to avoid this error. + +.. todo:: add an explanation of the $natural parameter: + + The $natural parameter returns items according to their order + on disk. (link to glossary item on natural order) + + For example, to return items in reverse order on disk, you + would invoke: + + db.collection.find().sort({$natural:-1})