Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54822

Push $sort before $unwind when possible

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 4.4.4
    • Fix Version/s: 5.1.0
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Query Optimization 2021-05-17, Query Optimization 2021-05-31, Query Optimization 2021-06-14, Query Optimization 2021-06-28

      Description

      $sort should be pushed automatically before $unwind if sort is happening on a different field.
      E.g.

      db.foo.aggregation([{$unwind: "fieldA"},{$sort: { fieldB: 1}}])
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              militsa.sotirova Militsa Sotirova
              Reporter:
              renato.riccio Renato Riccio
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: