MongoDB Setup
MongoDB Setup
April 16, 2024
Install
Set up Mongosh
- While you set up mongosh (Mongo Shell), you typically get the error below when you type
mongosh
on your terminal:
mongosh : The term 'mongosh' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ mongosh $Env:MDB_CONNECTION_STRING;
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (mongosh:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Solution
- To resolve this, you need to add Environment Variables. To do this:
- Go to “Edit System Environment Variables”
- Click on “Environment Variables”
- Under “System Variables”, Edit “Path”
- Add Two paths as follows:
- MongoDB bin path
C:\Program Files\MongoDB\Server\7.0\bin
- Depending on where you have downloaded mongosh:
C:\Users\yusuf\Downloads\mongosh-2.2.3-win32-x64\mongosh-2.2.3-win32-x64\bin
⚠️
Important: Restart your editor. If it does not work, go to services and restart mongoDB.