How to set environment variable for MongoDB in windows | MongoDB setting up the Environment Variable



How to set environment variable for MongoDB in windows | MongoDB setting up the Environment Variable

How to set environment variable for MongoDB in windows | MongoDB setting up the Environment Variable

Adding MongoDB to PATH Environment Variable in Windows
MySQL Installer by default doesn’t add the mongodb.exe to the PATH environment variable. As a result, every time we want to execute mongodb.exe we have to specify the full path to it. The mongodb.exe resides in the MongoDBServer4.2bin directory. But the path to MongoDB directory depends upon the architecture of the application. If you have installed x64 version then it should be in C:Program Files. Otherwise, it should be in C:Program Files (x86). On this system, MySQL is installation is in C:Program Files and the complete path to mongodb.exe is C:Program FilesMongoDBServer4.2bin
To add mongodb.exe to PATH environment variable follow these steps:

1. Hit Win+Pause/Break. This will open System Properties Window.

2. Click on Advanced system settings.

3. At the bottom of the newly opened window click on Environment Variables.

4. In the new window Select Path environment variable and click Edit.

5. Add ; at the end of the current variable value and append C:Program FilesMongoDBServer4.2bin(the exact may differ depending upon version and architecture of the application). Click OK to save.

Now start the Command Prompt and enter the following command:

mongo –version

Comments are closed.