MongoDB is not recognized as an internal or external command

A few days back, when I installed the MongoDB and start the MongoDB server by using the “mongo” command, I got the error “mongo is not recognized as an internal or external command“.

mongodb is not recognized as an internal or external command
MongoDB is not recognized as an internal or external command

In this MongoDB tutorial, we are going to resolve this error Mongo is not recognized as an internal or external command. These are the following topics that we are going to cover in this tutorial:

  • mongo is not recognized as an internal or external command
  • mongo-connector is not recognized as an internal or external command
  • mongo_url is not recognized as an internal or external command
  • Use is not recognized as an internal or external command

mongo is not recognized as an internal or external command

This error usually occurs because the system can not find the executable that you are asking to launch so to launch the file you have to provide the full path and after that, it will run without any issues.

This error comes because after installing the MongoDB database we also need to set the path of MongoDB in the system environment variable.

So to resolve this error you need to follow the below steps:

  • Open that folder where you install MongoDB
  • Open MongoDB folder till bin folder where mongod.exe file and copy the path
C:\Program Files\MongoDB\Server\5.0\bin>
mongo is not recognized as an internal or external command
copy the path of MongoDB
  • Now, open “edit the system environment variable” and click on Environment Variables button.
mongo is not recognized as an internal
Set Environment Variables
  • A new window is open, goto System Variables click on path and click on Edit button.
MongoDB not recognized as an internal or external command
Set the path of MongoDB
  • Again open a new window, click on new button and paste the above path here.
mongod is not recognized as an internal or external command
Set the path of MongoDB successfully
  • After that click on OK button and your MongoDB path is successfully saved into your system.
  • Now start the MongoDB server
Start MongoDB Server
Start MongoDB Server

Now see, we successfully resolve the error and we can start the MongoDB server without any error.

You may also like reading the following articles.

In this tutorial, we have resolved the error “MongoDB is not recognized as an internal or external command“. These are the following topics that we covered in this tutorial

  • mongo is not recognized as an internal or external command
  • mongo-connector is not recognized as an internal or external command
  • mongo_url is not recognized as an internal or external command
  • use is not recognized as an internal or external command