Skip to content

Commit 657ca78

Browse files
committed
DOCS-9153: rephrases sort order for compound indexes
1 parent 5a72fc5 commit 657ca78

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

source/tutorial/sort-results-with-indexes.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ appear in the index. For example, an index key pattern ``{ a: 1, b: 1
6262
}`` can support a sort on ``{ a: 1, b: 1 }`` but *not* on ``{ b: 1, a:
6363
1 }``.
6464

65-
The sort must specify the *same sort direction*
66-
(i.e.ascending/descending) for all its keys as the index key pattern or
67-
specify the *reverse sort direction* for all its keys as the index key
68-
pattern. For example, an index key pattern ``{ a: 1, b: 1 }`` can
69-
support a sort on ``{ a: 1, b: 1 }`` and ``{ a: -1, b: -1 }`` but *not*
70-
on ``{ a: -1, b: 1 }``.
65+
For a query to use a compound index for a sort, the specified sort direction
66+
for all keys must match the index
67+
key pattern *or* match the inverse of the index key pattern.
68+
For example, an index key pattern ``{ a: 1, b: -1 }`` can
69+
support a sort on ``{ a: 1, b: -1 }`` and ``{ a: -1, b: 1 }`` but **not**
70+
on ``{ a: -1, b: -1 }`` or ``{a: 1, b: 1}``.
7171

7272
.. _sort-index-prefix:
7373

0 commit comments

Comments
 (0)