Push $sort before $unwind when possible

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.1.0-rc0
    • Affects Version/s: 4.4.4
    • Component/s: None
    • Fully Compatible
    • Query Optimization 2021-05-17, Query Optimization 2021-05-31, Query Optimization 2021-06-14, Query Optimization 2021-06-28
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      $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}}])
      

              Assignee:
              Militsa Sotirova
              Reporter:
              Renato Riccio
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: