Skip to content Skip to sidebar Skip to footer

Numberlong Arithmetic In The Mongo Shell

How can I perform precise arithmetic on NumberLong values in the Mongo shell? It's my understanding that Javascript only has one numeric type - number - typically limited to 54-bi

Solution 1:

MongoDB uses the BSON 64 bit Int type (Mongo type code 18) for NumberLong. The db kernel can perform precise arithmetic on these elements (kernel written in C++) through doing update operations but if you want to do this in the javascript shell you'll need a library like this one from Google.


Post a Comment for "Numberlong Arithmetic In The Mongo Shell"