SERVER-136520ClosedFixed

Stage with kAllShardHosts followed by kTargetedShards without mergeShardId triggers 8596500

The tassert is triggered when a stage which sets HostTypeRequirement::kAllShardHosts is followed by a stage with which requires a shard but which does not set mergeShardId, such as $unionWith (kTargetedShards) or $group with allowDiskUse=true which disqualifies the mongos. We also need to have no collation on the command and the collection to be untracked. The following fail: [\{$planCacheStats: {allHosts: true}}, $unionWith: \{...}] [\{$planCacheStats: {allHosts: true}}, $group: \{.

Affected Versions
Versions known to exhibit this issue
9.0.28.3.118.0.328.0.34
Fixed Versions
Versions that include the fix
9.1.0-rc09.1.0-rc10259.0.9
Components
Server components related to this issue
Distributed Query Planning
Labels
Tags and classification
qo-triage-week