-
Type: Improvement
-
Resolution: Won't Fix
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:None
RE:
http://docs.mongodb.org/manual/tutorial/sort-results-with-indexes/#sort-and-index-prefix
http://docs.mongodb.org/manual/reference/operator/query/or/#or-and-sort-operations
It would be nice if there was an example of the effect of $or on sorted results. The second reference says indexes can be used to satisfy sort in the case of $or (presumably if all requirements are met) but doesn't really mention if there are any additional requirements.
What if only one of the indexes for one of the $or branches satisfies the sort criteria?
Since branches are evaluated independently they could potentially independently satisfy the sort too (a merge-sort at the top-level cannot be avoided), but I do not know the implemented behavior.
- is related to
-
SERVER-1205 $or sort does not use index ranges expressed in or clauses
- Closed