-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Query Optimization
-
Minor Change
-
140
$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.
- causes
-
SERVER-84237 Incorrect $mod aggregation expression results
- Closed
- is depended on by
-
COMPASS-7471 Investigate changes in SERVER-39336: In order to be schema friendly, $mod output should be based only on input types, not values
- Closed
-
TOOLS-3432 Investigate changes in SERVER-39336: In order to be schema friendly, $mod output should be based only on input types, not values
- Closed