-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework, Performance
-
Fully Compatible
-
Query 10 (02/22/16), Query 11 (03/14/16), Query 12 (04/04/16)
The subset of a $match following an $unwind that does not filter on the unwound field can be moved up in the pipeline.
For example:
[ {'$unwind' : "$x"}, {'$match' : {_id : 1, x : {'$gt': 3} } } ]
is equivalent to:
[ {'$match' : {_id : 1} }, {'$unwind' : "$x"}, {'$match' : {x : {'$gt': 3}} } ]
- depends on
-
SERVER-22833 MatchExpression::toBSON does not necessarily produce a valid query object.
- Closed
- is duplicated by
-
SERVER-4506 aggregation: optimize by pushing matches to earlier in a pipeline
- Closed
- is related to
-
SERVER-23444 Pessimizing moves break compile on clang 3.7+ (expression_tree.h)
- Closed
-
SERVER-4506 aggregation: optimize by pushing matches to earlier in a pipeline
- Closed
- related to
-
SERVER-23469 $match involving field generated from $unwind is pushed ahead of $unwind in pipeline
- Closed
-
SERVER-4506 aggregation: optimize by pushing matches to earlier in a pipeline
- Closed