SERVER-139293In Progress

Incorrect output in $bucketAuto's $mergeObjects

In $bucketAuto's $mergeObjects, the value for each field should come from the document that is last in the input, tracked by its input position. When a value arrives, we compare its position with the largest position recorded for that field and only overwrite the output if it is greater. However, the recorded position is not updated when we overwrite the value. So the stored position stays at the first one seen for that field, and later values are compared against it instead of against the lates

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

No labels assigned.