-
Type: Task
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 3.2.8
-
Component/s: mongoexport
-
Environment:OS X El Capitan
MongoDB v3.2.8 (via macports)
-
Platforms 2017-01-23
-
Needed
-
v3.2, v3.0
I have been trying to export data to CSV with integer ID values that are stored as doubles.
Unfortunately, the larger numbers are exported in scientific notation, which means that either the ID is no longer accurate due to a decrease in significant digits, or that the target DB cannot interpret the numbers as it cannot parse scientific notation.
It would be very useful to have one of two options:
1) Something like a --toString option that simply converts all values to strings. They are typically not surrounded by quotations, so can easily be interpreted in any manner by another tool.
2) An equivalent to the --fieldFile option where the data format can be specified.
Currently I have to run scripts that do something like:
db.collection.find().forEach(function(item)
{ item.clientID = '' + item.clientID db.tmpcollection.insert(item) })
and then export the temporary collection.
If implemented, there would need to be changes to the documentation for mongoexport describing the solution.