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

Improve efficiency of matching during an aggregation pipeline.

    XMLWordPrintable

    Details

      Description

      It's currently very expensive to perform a $match within the aggregation pipeline. This is mostly because the aggregation pipeline works with Documents, which are incompatible with the current MatchExpression::matchesBSON interface, so we have to construct an entirely new BSONObj to match on. There are two things we could do to make this more efficient:

      1. Instead of converting the entire Document to BSON, we could only convert the fields needed by the match. For example, if the match was {a: {$gte: 4}}, we would only need the field a from the document.
      2. We could extend the MatchExpression interface to support matching Documents. A Document is logically equivalent to a BSONObj, so it would just be a matter of adapting the matching to use a different API with the object.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: