Combine multiple adjacent $match commands into one

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.4.10
    • Component/s: Aggregation Framework
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      If an aggregation pipeline contains multiple $match commands next to each other, they should be treated like a single $match with the items combined with $and.
      I noticed a huge difference (around a factor of 100) when i tried

      {$match: {"non-indexed-property": "value"}}, {$match: {"indexed-property": "value"}}
      

      vs.

      {$match: {"$and": [{"non-indexed-property": "value"}, {"indexed-property": "value"}]}}
      

              Assignee:
              Unassigned
              Reporter:
              Jochen Kemnade
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: