Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-9499

Docs for SERVER-20506: Conditionally order $match with $unwind

      Engineering Ticket Description:

      The subset of a $match following an $unwind that does not filter on the unwound field can be moved up in the pipeline.

      For example:

      [
        {'$unwind' : "$x"}, 
        {'$match' : {_id : 1, x : {'$gt': 3}  } }
      ]
      

      is equivalent to:

      [ 
         {'$match' : {_id : 1} }, 
         {'$unwind' : "$x"}, 
         {'$match' : {x : {'$gt': 3}} }
      ]
      

            Assignee:
            andrew.aldridge@mongodb.com Andrew Aldridge
            Reporter:
            emily.hall Emily Hall
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              1 year, 5 weeks ago