SERVER-138551Needs Scheduling

StaleConfig error when $unionWith pipeline begins with $collStats in random shard passthough

An aggregation whose pipeline contains a {{$unionWith}} whose sub-pipeline begins with a cursorless stage ({{{}$collStats{}}}) fails with a *non-retryable* StaleConfig ("timestamp mismatch detected") whenever the node that executes the {{$unionWith}} is not the shard that owns the foreign collection. This is hit deterministically on clusters where tracked unsplittable collections live off the merging node (e.g. after {{{}moveCollection{}}}, or when unsharded collections are tracked upon creation

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix

No fix available yet.

Components
Server components related to this issue

No components specified.

Labels
Tags and classification
qe-bf-triage-week