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

$dateAdd/$dateSubtract do not detect an overflow for certain 'amount' values

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.4, 5.1.0-rc0
    • Affects Version/s: 5.0.0, 5.1.0
    • Component/s: None
    • None
    • Minor Change
    • ALL
    • v5.0
    • QE 2021-09-06, QE 2021-09-20
    • 136

      $dateAdd/$dateSubtract expressions do not detect an overflow for certain 'amount' values. A result is undefined in such cases. An example of an expression that overflows:

          {"$dateAdd":
                  {"startDate" : Timestamp(0, 4294967295),
                  "unit" : "month",
                  "amount" :  {$multiply: [NumberLong("314159265358979383")]},
                  "timezone" : "+1187" }};
      

            Assignee:
            mindaugas.malinauskas@mongodb.com Mindaugas Malinauskas
            Reporter:
            mindaugas.malinauskas@mongodb.com Mindaugas Malinauskas
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: