-
Type: Improvement
-
Resolution: Fixed
-
Priority: Critical - P2
-
Affects Version/s: None
-
Component/s: Aggregation Framework, Text Search
-
None
-
Fully Compatible
-
v4.2
-
Query 2019-12-16
-
(copied to CRM)
FTS needs the ability to run an updateLookup change stream directly against a shard mongoD in a cluster. At present, this is not possible, because MongoInterfaceShardServer::attachCursorSourceToPipeline only expects to run in the context of a $lookup, and therefore uasserts if the collection is sharded.
When a change stream specifies {fullDocument: "updateLookup"} and we come across an update event, we do the updateLookup here. This calls into MongoInterfaceStandalone::lookupSingleDocument and eventually reaches MongoInterfaceStandalone::makePipeline. When this attempts to call attachCursorSourceToPipeline, though, the fact that this is a shard server becomes relevant. Instead of calling MongoInterfaceStandalone::attachCursorSourceToPipeline, we instead call MongoInterfaceShardServer::attachCursorSourceToPipeline. We only expect this to be called for $lookup, never for a change stream; and so we unconditionally throw if the collection we are attempting to read from is sharded.