I had a similar error when I tried to run my mongo db through cmd. However, the difference was that I had a configuration file that had a path to the db and log folders and wanted to use them. I used mongo a few days ago and it worked fine, but when I started using it again today, it gave me an error:
2015-05-27T10:33:22.820-0400 I CONTROL Hotfix KB2731284 or later update is installed, no need to zero-out data files MongoDB shell version: 3.0.2 connecting to: test 2015-05-27T10:33:23.854-0400 W NETWORK Failed to connect to 27.0.0.1:27017, reason: errno:10061 No connection could be made because the target machine actively refused it. 2015-05-27T10:33:23.857-0400 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at connect src/mongo/shell/mongo.js:179:14) at (connect):1:6 at src/mongo/shell/mongo.js:179 exception: connect failed
Here is how I fixed it:
- Open cmd as admin and go to the bin folder of your MongoDB and type:
mongod --config <path to your config file> --install - Now start the mongo db service:
net start mongodb you should receive a message saying: The MongoDB service was started successfully. - close this command line and open another as administrator, go to the bin folder again and enter
mongo
This will lead you to the mongodb test .
Press ctrl + c at any time to exit.
Hope this helps.
API May 27 '15 at 14:50 2015-05-27 14:50
source share