The-coder
The-coder

Reputation: 61

When can I use the command 'mongod' in Command Line?

I recently installed the version 4.4 of MongoDB,I followed all the instructions as in the documentation of mongodb. As instructed by my tutor I created another folder named 'mongodb'in my pc,inside which I created another folder named 'data' as well.Now i went to the command prompt and entered into the same mongodb folder i created earlier and typed the following command.

C:\Users\Dell\mongodb>mongod --dbpath=data --bind_ip 127.0.0.1

When I press Enter I see an error :

'mongod' is not recognized as an internal or external command,operable program or batch file.

I am totally stuck in this.I even reinstalled mongodb again,but it is not working.

Upvotes: 2

Views: 176

Answers (1)

Abhilekh Gautam
Abhilekh Gautam

Reputation: 655

You might have a problem with path in Mongodb. After the installation process ends open a Command Interpreter with Administrative privileges and run:

"C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe"

Now afterward you can use the 'mongod' Command. If still you are unable go to the pre insatlled Mongodb folder copy the path upto bin .

Now go to :

controlpanel>system and security>system>Advanced system settings.

A dialogue box appears and then at the bottom there is the option for Environment Variables.Click on that. If Mongodb variable already exit delete that and click on the path option. You might see a new option somewhere around click on that and input box appears.Now paste the copied path in that box and click save/Ok or sth to end the options.

Now you can use the 'mongod' command .

Upvotes: 1

Related Questions