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: \{.