I have installed mongo db. Then when i tried to execute .mongo or mongo in command prompt. It's showing this error:
.mongo' is not recognized as an internal or external command, operable program or batch file
I'm following some tutorial, So I'm not able to move further because i got stuck here. Help!
After version 6.0. 0 mongo.exe does not get installed to your bin folder so you have to manually install the new MongoDB shell which is called mongosh then you have to add its path to your system variables and then run mongosh --version to see if it got installed.
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.
I think you might forgotten setting Environment variables for Mongo’s bin folder.Follow this,and try again.
Set Environment variables for mongo db's bin folder path
This is an answer I posted on a similar question, for those that want a step-by-step guide:
bin
folder to the "Path" Environment VariableHere's how on Windows 10:
If you're not sure where it is, it's probably in C:\Program Files\MongoDB\Server\3.4\
3.4 was the latest stable version at the time, this will be different for you probably.
It should look like this:
Notice this is the path to mongo.exe and mongod.exe. Adding this folder to the Path variable is telling Windows to search in this folder for executables matching your command when you run something in cmd. The search starts with the current working dir, and if it doesn't find your exe, goes on to search all the paths in Path till it finds it or it doesn't and it gives you that error you saw.
Copy the path to the bin folder. It should be C:\Program Files\MongoDB\Server\3.4\bin\
(Or whatever version you're using)
Press win, type env
, Windows will suggest "Edit the System Environment Variables", click that.
\
like so:Now you should be able to run mongod
and mongo
from anywhere in a command window.
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