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

Combine multiple adjacent $match commands into one

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

      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 Unassigned
            Reporter:
            jkemnade Jochen Kemnade
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: