-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
I'm thinking of a query like so:
db.foo.aggregate([{$replaceWith: "$x"}, {$match: {y: 1}}, {$project: {y: 1}}])
SERVER-72037 describes the work to push the $match before the $replaceWith. But even if that is complete, we would seem to stop our projection/dependency analysis at the $replaceWith stage there and miss that the query only needs "x.y", not all of "x". If "x" had many sub-fields, this could be a dramatic savings.
- is related to
-
SERVER-72037 Allow $replace(With|Root) to participate more in $match optimizations
- Closed