0

I have tried various commands for importing csv file into mongodb but most are giving errors."unexpected identifier"

mongoimport -h host:port -d experimental2 -c <collection> -u <user> -p <password> --file <input .csv file> --type csv --headerline

mongoimport -h localhost --port 27017 -d test -c forcasting --type csv --file ~/Desktop/forecasting.csv

mongoimport -h piyushl  --port 27017 -d test -c forcasting --type csv --file ~/Desktop/forecasting.csv

mongoimport -h localhost:27017 -d test -c forcasting -u Piyushl --file forecasting --type csv --headerline

But nothing seems to work.

Nagama Inamdar
  • 2,851
  • 22
  • 39
  • 48
  • what delimiter you have in your csv ? comma or some thing else – Sumeet Kumar Yadav Apr 14 '14 at 06:18
  • if you ran the command there must have been some output, please share that we can help from there on. – Anantha Sharma Apr 14 '14 at 06:18
  • Could you also check if there are special identifiers or if file contains values in different unicode. – Lalit Agarwal Apr 14 '14 at 07:01
  • Microsoft Office Excel Comma Separated Values File. NOte the output is "unexpected identifier" as mentioned above.The file does not have different unicode. – user3530723 Apr 14 '14 at 08:29
  • Does this help : http://stackoverflow.com/questions/15679398/mongodb-importig-and-exporting-to-csv – Lalit Agarwal Apr 14 '14 at 08:34
  • Unexpected identifier means that there is something invalid (from a mongoimport perspective) within your CSV file. Without seeing the full CSV file we will be unable to give you a definitive answer as to what the issue is. – daveh Apr 16 '14 at 05:57

0 Answers0