mongodbmongoexport

mongoexport returning scientific (exponential) notation


So I was exporting some collections using mongoexport and found cases where large integers such as 9999999999999 were exported as 9.9999999999999e+13

So two questions: Why is this the case, and how can I prevent this?

Thank you.


Solution

  • MongoDB treats all number literals as floating point by default, and above a certain threshold (32 bits?) it switches to scientific notation when exporting to JSON.