Details
-
Question
-
Resolution: Done
-
Major - P3
-
None
-
2.4.9, 2.6.3
-
None
Description
For some reason, using parseInt or parseFloat on NumberLong gives NaN, but using arithmetic operations converts them to ints/floats without issues?
See the following:
> parseInt(NumberLong(2))
|
NaN
|
> parseFloat(NumberLong(2))
|
NaN
|
> NumberLong(2) + NumberLong(0)
|
2 <-- this is an int, not NumberLong |
So this obviously works:
> parseInt(NumberLong(2) + NumberLong(0))
|
2
|
Tested on Mongo 2.4.9 and 2.6.3. This seems like a completely illogical behaviour. This became important since PHP driver converts every number to NumberFloat.