[SERVER-10613] Optimize simple aggregations using $redact followed by a $match Created: 23/Aug/13  Updated: 28/Oct/15  Resolved: 11/Oct/13

Status: Closed
Project: Core Server
Component/s: Aggregation Framework, Performance
Affects Version/s: None
Fix Version/s: 2.5.3

Type: Improvement Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Participants:

 Description   

Current (2.5.2) implementation will not use any indexes if the first operation in the pipeline is $redact. If the pipeline starts with [$redact, $match, ...] we can in some circumstances convert the query to [$match, $redact, $match, ...] and get the same results.

Known cases where this won't be allowed:

  • Equality matching an object-typed field.
  • Any test that filters based on the non-existance of a field (at least $nin, $ne, and probably $not)


 Comments   
Comment by auto [ 11/Oct/13 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-10613 Optimize initial $redact/$match pair

If possible, inserts a subset of the $match before the $redact to enable
index usage and reduce the number of documents that need to be examined.
Branch: master
https://github.com/mongodb/mongo/commit/b7d3dccc728ba17c89d30cc134f48326ba68098f

Generated at Thu Feb 08 03:23:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.