How to import large amount of csv data to mongodb
mongoimport -d <dbname> -c <collection_name> --type csv --file </path/to/actual/file.csv> --headerline
<blah> - Replace with your respective values
-d <dbname> - Tells to your mongo server into which database you want to import
-c <collection_name> - Tells to your mongo server in <dbname> into which collection you want to import
--type csv - Says it is a csv file
--file <path> - Give full path to your csv file
--headerline - if given, uses the first line as field names.
mongoimport -d <dbname> -c <collection_name> --type csv --file </path/to/actual/file.csv> --headerline
<blah> - Replace with your respective values
-d <dbname> - Tells to your mongo server into which database you want to import
-c <collection_name> - Tells to your mongo server in <dbname> into which collection you want to import
--type csv - Says it is a csv file
--file <path> - Give full path to your csv file
--headerline - if given, uses the first line as field names.
No comments:
Post a Comment