Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-39336

In order to be schema friendly, $mod output should be based only on input types, not values

    • 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.

            Assignee:
            james.harrison@mongodb.com James Harrison
            Reporter:
            jacob.evans@mongodb.com Jacob Evans
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: