SERVER-98423ClosedWorks as Designed

Results differ depending on the order of operands in $sum inside $group with optimizations on

This came up while investigating BF-35904. The minimized query looks like this The explain output for optimizations turned has the operands swapped like so while with optimizations off the operands remain in the same order this change comes from [ExpressionNary::optimize()|https://github.com/10gen/mongo/blob/27d91db841953662a6780bcc4faba34dc257bd5a/src/mongo/db/pipeline/expression.cpp#L3066] as it will hold the ExpressionConstant operand in a [separate array|https://github.com/10gen/mon

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.