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

$mod truncates divisor and remainder to int value

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.19
    • Component/s: None
    • Query 2020-09-21

      $mod treats it's divisor and remainder arguments as int values. This could lead to unexpected behaviour when these arguments are larger than int. For example:

      > db.createCollection('test')
      > db.test.insert([{a: 4000000000}])
      > db.test.find({a: {$mod: [4000000000, 0]}})

      The last query should return the single record from the test collection, but returns nothing instead.

            Assignee:
            nikita.lapkov@mongodb.com Nikita Lapkov (Inactive)
            Reporter:
            nikita.lapkov@mongodb.com Nikita Lapkov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: