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

$multiply incorrectly throws an error in some cases in the classic engine

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.11, 4.2.18, 4.0.28, 5.0.4, 5.1.0-rc2
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • ALL
    • v5.1, v5.0, v4.4, v4.2, v4.0
    • QE 2021-10-18, QE 2021-11-01
    • 149

      I came across a simple case in the classic engine where $multiply throws an error when it shouldn't. Here is the repro:

      > db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true});
      > db.c.drop();
      > db.c.insert({a: 1.0});
      > db.c.find({}, {x: {$multiply: ["$a", 1.0e+35]}})

      When I run the commands above in the classic engine, I get the following error:

      "Executor error during find command :: caused by :: Can't coerce out of range value -9.8696e+34 to long"

      The example above is simply multiplying the double 1.0 by the double 1.0e+35. There is no reason that this operation should fail.

      The goal of this task is to investigate why the failure described above is occurring, and to implement the appropriate fix.

      As part of this work, once the issue is solved, $multiply should be marked as sbe-compatible again (undoing SERVER-60583.)

            jennifer.peshansky@mongodb.com Jennifer Peshansky (Inactive)
            andrew.paroski@mongodb.com Drew Paroski
            0 Vote for this issue
            4 Start watching this issue