File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
source/reference/operator/aggregation Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -117,8 +117,11 @@ option in :method:`db.collection.aggregate()` method and the
117
117
118
118
:pipeline:`$sort` operator can take advantage of an index when
119
119
placed at the **beginning** of the pipeline or placed **before**
120
- the following aggregation operators: :pipeline:`$project`,
121
- :pipeline:`$unwind`, and :pipeline:`$group`.
122
-
120
+ the :pipeline:`$project`,
121
+ :pipeline:`$unwind`, and :pipeline:`$group` aggregation operators.
122
+ If :pipeline:`$project`, :pipeline:`$unwind`, or :pipeline:`$group`
123
+ occur prior to the :pipeline:`$sort` operation, :pipeline:`$sort`
124
+ cannot use any indexes.
125
+
123
126
.. todo:: if a sort precedes the first $group in a sharded system,
124
127
all documents must go to the mongos for sorting.
You can’t perform that action at this time.
0 commit comments