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

Push $sort before $unwind when possible

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 4.4.4
    • 5.1.0-rc0
    • None
    • Fully Compatible
    • 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

              militsa.sotirova@mongodb.com Militsa Sotirova
              renato.riccio@mongodb.com Renato Riccio
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: