I have a JSON file which I want to import on MongoDB. I am very new to both. Do I need to keep my JSON file to some specific folder and what should be the command.
1 Answer
mongoimport is the command to upload JSON data into Mongo collection.
Go to the folder where you have JSON file and execute the below command after changing the parameters accordingly.
mongoimport -d <databasename> -c <collectionname> < <filename>.json
Example:
mongoimport -d students -c grades < grades.json
2 Comments
A-dude
"Go to the folder where you have JSON file" this is the part for which I asked the question once I am running the mongo how to do this part
notionquest
Open another command prompt (i.e. normal command prompt window) and run this command. In other words, you have to execute this command outside the mongo shell. Just like normal windows command. I hope you have included the mongo installation path in the windows PATH environment variable which would allow you to find "mongoimport.exe".