Support limit copy in stages that absorb unwind

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In SERVER-27598 we implemented a re-write:

      ..., {$unwind: {..., preserveNullAndEmptyArrays: true}}, {$limit: X}, ...

      into

      ..., {$limit: X}, {$unwind: {..., preserveNullAndEmptyArrays: true}}, {$limit: X}, ...

      However, if $unwind is absorbed by $lookup or $graphLookup, this optimization is not performed. See repro.js

      lookup-unwind is a very popular query patter, so this should be improved.

              Assignee:
              Unassigned
              Reporter:
              Ivan Fefer
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: