New to MongoDB. I'm following this tutorial, and I get the above error when trying to follow Step 2. I'm putting the command into a Windows Command Prompt, and I've set my directory to the location of the 'mongoimport' file (C:\MongoDB). I've also included the same directory in my PATH, and the primer-dataset.json file is saved in that location. I'm fairly confident MongoDB is installed properly.
If you have CSV files (or TSV files - they're conceptually the same) to import, use the --type=csv or --type=tsv option to tell mongoimport what format to expect. Also important is to know whether your CSV file has a header row - where the first line doesn't contain data - instead it contains the name for each column.
To import JSON file you need to follow the following steps: Step 1: Open a command prompt and give command mongod to connect with MongoDB server and don't close this cmd to stay connected to the server. Step 2: Open another command prompt and run the mongo shell. Using the mongo command.
From Version 4.4.0 You have to install the MongoDB Database Tools separately, mentioned here.
To install.Then to go the bin directory of Tools (mostly C:\Program Files\MongoDB\Tools\[version]\bin) and open command prompt there.
Now execute the command here. This should work or else add .\
in the beginning as mentioned by Cody w above.
If you want to execute your command from your current path (not only from mostly: C:\Program Files\MongoDB\Tools...\bin Path), you can do step 3 of this link (Make the DB Tools available in your PATH)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With