Reputation: 167
I want to import data from a CSV file into MongoDB. There are some long and double values stored in the CSV. How do I import these long and double values as long and double into mongodb using mongoimport command. Writing a script is another thing I have written this script but I want to use mongoimport to make it more easier. What I basically want is MySQL like import which allows me to assign datatype while importing the data.
Upvotes: 1
Views: 2219
Reputation: 566
mongoimport will always use the default double representation. It can't be used to differentiate between double and long.
See Reference > MongoDB Package Components > mongoimport
Note Do not use mongoimport and mongoexport for full instance, production backups because they will not reliably capture data type information. Use mongodump and mongorestore as described in Backup Strategies for MongoDB Systems for this kind of functionality.
Upvotes: 2