Is there any way to perform integer arithmetic on two NumberInt or NumberLongs in MongoDB's mapreduce Javascript or in the shell? As you see, I get:
> typeof (NumberInt(1) + NumberInt(1))
number
# (and this is here sort of just to gripe)
> NumberLong(2) == NumberInt(2)
false
> 2==NumberLong(2)
true
> 2==NumberInt(2)
true
Relevant:
- mongo db map reduce sum results as integer seems to be the same, but I get different results.
- NumberLong arithmetic in the Mongo shell is far from trivial to actually do.