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

Push $sort before $unwind when possible

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 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

      $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@mongodb.com Militsa Sotirova
            Reporter:
            renato.riccio@mongodb.com Renato Riccio
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: