|
$mod has a special condition if the right-hand-side is of non-integral type but of integral value.
https://github.com/mongodb/mongo/blob/8387824b3ac937b0489fcb94c590cc663b47348c/src/mongo/db/pipeline/expression.cpp#L2528
We should eliminate this condition from the conditional so that the output type of an arithmetic expression is based only on input types, not values. This has two benefits:
It causes a pipeline to output documents that are closer to a fixed schema.
Non-deterministicly-ordered input to grouping stages will no longer cause output of arbitrary type. This will eliminate the linked agg fuzzer issue.
|