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

Support NumberLong arithmetic in mongo shell and server JS

    XMLWordPrintable

Details

    Description

      Currently, NumberLongs are automatically cast to numbers when arithmetic is performed on them (courtesy of .toNumber()). This means that doing something like trying to subtract two NumberLongs returns a double-precision number, not a NumberLong. This causes a loss of precision, and this in turn means that hashed shard key values can't be manipulated in the shell.

      Supporting natural syntax like NumberLong("...") - NumberLong("...") isn't necessary, it would suffice to be able to do something like NumberLong("...").subtract(NumberLong("...")) and get back a NumberLong.

      Attachments

        Issue Links

          Activity

            People

              backlog-server-platform DO NOT USE - Backlog - Platform Team
              kevin.pulo@mongodb.com Kevin Pulo
              Votes:
              3 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated: