Mongod command not working?

I have used the same command 20 times over the last week, and now it not working.
I go to the directory C:\Program Files\MongoDB\Server\5.0\bin and use the command mongod

For some reason now I get an error
mongod : The term ‘mongod’ is not recognized as the name of a cmdlet, function, script file, or operable program.

Edit: For those who may have the same problem. I now have to use the following to get it to work
./mongod

Hello there,

I am unsure of the issue you are experiencing.

However, I suggest trying these steps, because it is usually easier, and is common practice anyway.

Most of this assumes you are on Windows 10/11:

  1. Open Start, and type in env:
    image
  2. Open the System Environment Variables
  3. Click on Environment Variables
  4. Click on Path and Edit...
  5. Add a that directory ...\bin\mongod as a new variable.

Next time you restart your shell/terminal, you should be able to run mongod from anywhere in your terminal.

Hope this helps

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.