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

Combine multiple adjacent $match commands into one

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.4.10
    • Aggregation Framework

    Description

      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"}]}}

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: