17 Jun 2014
mongoDB – import a CSV file in a database collection
Suppose if you have a CSV file with large number of records and you want to import it into database collection then need to use
mongoimport
mongoimport --db users --collection contacts --type csv --headerline --file contacts.csv
--db
will specify database,
--collection
will represent contacts collection
--type
is representing that CSV file
--headerline
is representing the top line in file is header or column names.
--file
is path to file to import