Mongo import not working

I am trying to import the data from a csv file on windows 10 command prompt using the below command

mongoimport --file C:\Makelive local\products.csv --type csv --port 27017 --db dummyDB --collection products

It is getting failed and throws below error. Any help would be appreciated
error parsing command line options: error parsing positional arguments: cannot use both --file and a positional argument to set the input file

Use double quotes for the --file parameter
or
cd to the dir where your file is residing and pass just the file name (products.csv without path)
You may get additional errors like use fields or to use headerline for importing .csv file

4 Likes

this worked for me:
mongoimport -d databasename -c collectionname --type JSON --file “path+.json”

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.