Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/core/indexes-introduction.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ directly from the index without requiring an additional sort phase.

.. include:: /images/index-for-sort.rst

An index is traversable for sorting in either direction. For details, see
:ref:`sorting-with-indexes`.


Covered Results
~~~~~~~~~~~~~~~

Expand Down
6 changes: 4 additions & 2 deletions source/tutorial/sort-results-with-indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ traversing the index in reverse order:

db.records.find().sort( { a: -1 } )

.. _sort-on-multiple-fields:

Sort on Multiple Fields
-----------------------

Expand Down Expand Up @@ -100,7 +102,7 @@ memory.
- ``{ a: 1 }``

* - ``db.data.find().sort( { a: -1 } )``

- ``{ a: 1 }``

* - ``db.data.find().sort( { a: 1, b: 1 } )``
Expand Down Expand Up @@ -158,7 +160,7 @@ The following operations can use the index to get the sort order:
- ``{ a: 1 , b: 1, c: 1 }``

* - ``db.data.find( { b: 3, a: 4 } ).sort( { c: 1 } )``

- ``{ a: 1, b: 1, c: 1 }``

* - ``db.data.find( { a: 5, b: { $lt: 3} } ).sort( { b: 1 } )``
Expand Down