Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
None
-
Fully Compatible
-
Query 10 (02/22/16), Query 11 (03/14/16), Query 12 (04/04/16)
Description
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}} } |
]
|
Attachments
Issue Links
- depends on
-
SERVER-22833 MatchExpression::toBSON does not necessarily produce a valid query object.
-
- Closed
-
- is documented by
-
DOCS-9499 Docs for SERVER-20506: Conditionally order $match with $unwind
-
- 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
-