-
Type: New Feature
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework, Querying
-
None
-
Fully Compatible
-
Query 2018-01-01, Query 2018-01-15, Query 2018-12-17
-
100
In order to support $changeStreams "updateLookup" functionality (see the documentation here), the aggregation subsystem now has machinery for $lookup-like query execution on mongos.
We should extend this functionality to work for the $lookup stage itself:
- When the foreign collection is sharded, split the pipeline such that the $lookup is part of the merging pipeline. Execute the merging pipeline on mongos, performing lookups across the network to the shards as needed.
- If the foreign collection is not sharded, send the merging part of the pipeline to the primary shard and perform local lookups, just as we do in all existing versions of MongoDB.
- If the merging part of the pipeline containing the $lookup cannot execute on mongos, raise an error to the application.
- Support only localField/foreignField $lookup for now; adding support for $lookup with a sub-pipeline into a sharded foreign collection is future work.
- is depended on by
-
SERVER-38728 Allow pipeline with $lookup into a sharded collection to run on mongod
- Closed
-
SERVER-32309 Serialize variables within nested pipelines which are defined in an outer context
- Closed
-
SERVER-32666 Allow $graphLookup against a sharded collection to execute on mongos
- Closed
-
SERVER-39238 Allow foreign $lookup pipeline split at DocumentSourceSequentialDocumentCache
- Backlog