-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: JavaScript, Shell
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.
- is duplicated by
-
SERVER-14846 Expose basic arithmetic operations for NumberLong
- Closed
- is related to
-
SERVER-19676 NumberDecimal(...) + NumberDecimal(...) should not cause string concatentation
- Closed
- related to
-
SERVER-4141 NumberLong.bottom does not return values
- Closed
-
SERVER-19943 Support NumberDecimal arithmetic in mongo shell and server JS
- Closed