[DOCS-5804] Add example for $or case to the sorting with indexes tutorial Created: 09/Jul/15  Updated: 30/Oct/23  Resolved: 01/Nov/22

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Major - P3
Reporter: Andrew Ryder (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-1205 $or sort does not use index ranges ex... Closed
Participants:
Days since reply: 1 year, 14 weeks, 1 day ago
Epic Link: DOCSP-1769

 Description   

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.



 Comments   
Comment by Education Bot [ 01/Nov/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Generated at Thu Feb 08 07:51:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.