Optimize $match $unwind $match sequence in pipeline

XMLWordPrintableJSON

    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When looking to do aggregations on a subset of documents in arrays, the current "best" practice is to do $match first, then $unwind then $match again.

      In other words, if our pipeline is:
      {$match:{array.Member:"value"}},{$unwind:"$array"},{$match:{"array.Member":"value"}}

      if we can optimize this into something that eliminates unneeded array elements along with unneeded fields this could be reduced to one $match and no $unwind.

      redbeard0531 this is what we talked about yesterday, please re-write the description if I didn't capture what we were discussing accurately.

              Assignee:
              Unassigned
              Reporter:
              Asya Kamsky
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: