Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-5804

Add example for $or case to the sorting with indexes tutorial

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: manual, Server
    • Labels:
      None

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kay.kim Kay Kim
                Reporter:
                andrew.ryder Andrew Ryder
                Participants:
                Last commenter:
                Kay Kim
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Days since reply:
                  4 years, 6 weeks, 6 days ago