i

Start mongod and mongo services

Step 8:  Al the mongo DB related files are available under the location: C:\Program Files\MongoDB\Server\4.2\bin. To start MongoDB, first, we have to start mongod. After that, we have to begin mongo to start the MongoDB client.

Location: C:\Program Files\MongoDB\Server\4.2\bin

 

Step 9:Now, we will start a command prompt and go the location of the mongod application file. Then run mongod on command prompt.

If everything is fine, it will continue blinking in the left below side of the command prompt. It means the mongo daemon has been started. Do not close this.

Step 10: Open another command prompt and go to the location of the mongo application file (same as mongod). Then run the command mongo.

If everything is fine, the cursor will blink in the below-left hand side. Just use the below command to check the available default databases in MongoDB.

 

Step 11: In this section, we are going to set the environment variable for MongoDB so that we can access mongod and mongo anywhere.

Go to Advanced system settings.

Then go to Environmental Variables.

Go to the System variables section. Select the Path variable and double click on it. Press the New button and add the location of the bin folder ( mongod and mongo). Then press ok to accept the changes.

Step 12: Now you will be able to run mongod or mongo command from any location