Getting "'mongoimport' is not recognized as an internal or external command, operable program, or batch file." when trying to import data from a file

Levighosta picture Levighosta · Jun 25, 2015 · Viewed 30.1k times · Source

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.

Answer

Fawzy Mokhtar picture Fawzy Mokhtar · Oct 4, 2018

This error message means that there is no PATH in your system for mongodb server folder. Follow these steps (for Windows OS):

  1. Navigate to C:\Program Files\MongoDB\Server\[your_server_version]\bin.
  2. Copy this path.
  3. In start menu search for View advanced system settings and open it.
  4. Select Advanced tap.
  5. Click on Environment Variables button.
  6. In the System Variables list find element Path, select it and click Edit.
  7. Paste the path which you copied before. [IMPORTANT for windows 7] don't forget to put a semicolon in front of the path to separate this new path for the others. Like this ;C:\Program Files\MongoDB\Server\4.0\bin.
  8. Click OK button for all opened windows.
  9. Close all opened Command Prompt windows.
  10. Open a new Command Prompt window and try again.