-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework, Performance
-
None
-
Fully Compatible
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)