SERVER-138000ClosedFixed

$setWindowFields with sortBy after a join-optimized $lookup+$unwind hits tassert

$setWindowFields desugars to \{$sort: {..., $_internalOutputSortKeyMetadata: true}} plus $_internalSetWindowFields. The sort-key metadata dependency reaches the base collection CanonicalQuery, the planner puts a SORT_KEY_GENERATOR on top of the access plan, and CBR has no estimate for that node in single_table_access.cpp. A plain \{$sort: {_id: 1}} suffix does not trigger it.

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
9.1.0-rc09.1.0-rc1025
Components
Server components related to this issue

No components specified.

Labels
Tags and classification
found-by-ai