Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 333
Reuben L. Avatar asked Oct 18 '22 07:10

Reuben L.


1 Answers

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.

like image 106
Ghislain Fourny Avatar answered Nov 15 '22 06:11

Ghislain Fourny