-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Currently we only push down $match & $project stages across $unionWith branches. However, any stage that operates on a single document at a time can safely be pushed down. For example:
{$unionWith: {coll: ..., pipeline: [...]}}, {$lookup: {...}}, {$unwind: ...}
Is equivalent to:
{$lookup: {...}}, {$unwind: ...}, {$unionWith: {coll: ..., pipeline: [{$lookup: {...}}, {$unwind: ...}]}}
This is useful, because the first version was not eligible for SBE pushdown, but the second version is.