MongoDB on a Windows 7 machine: No connection could be made

I got this problem. What fixed mine is:

  1. Suppose you have a dir: "C:\mongo_databse"
  2. Open Command Prompt and type (suppose you haved added the Mongo bin directory to PATH): mongod --dbpath=C:/mongo_database. There will be some log to the command prompt.

  3. Now open ANOTHER command prompt then type in mongo then it works.


I got the same error and fixed it with:

1) mkdir c:\data

2) cd data

3) mongod -dbpath .

4) Now in another command window I was able to connect from my client using the mongo command.