0
votes

I have a problem for a month and I did not find a solution.Both my laptop and PC have these problems(I started mongod before):

Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91 exception: connect failed

Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:93 exception: connect failed

Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:L112 exception: connect failed

I have started the mongod process without any parameter.And also I have a reply message by pinging 127.0.0.1

By the way I use windows os and It does not have any permission issue. In addition I started the data directory from scratch but did not work. (There is no error in mongod's log file)

Any help ?

3
Can you telnet to 127.0.0.1 27017? This would confirm whether the port is open and reachable as expected. Also can you provide the command line arguments used for the mongo shell?James Wahlin
telnet sais Connecting To 127.0.0.1...Could not open connection to the host, on port 27017:Connect failed.I have used several form of parameter like mongod, mongod --smallfiles --dbpath c:\db and so on.I addition, I authunticated the 27017 and mongod process in firewall setting.But no hope.Mobin Ranjbar
When you start mongod does it wait for connections or is it immediately closing again?Sammaye
No it waits for connection : waiting for connections on port 27017Mobin Ranjbar
Are you attempting to connect from the same machine that your mongod process is running on?James Wahlin

3 Answers

8
votes

I received this error because I accidentally ran "mongo.exe" instead of "mongod.exe". So, of course, Mongo complained that it had no database to connect to. ;)

0
votes

Oops! My problem is solved.The problem was a software called "Proxifier" that blocked my localhost.I closed it and It worked properly.

-1
votes

open your task manager.. click on services.. find mongodb and right click on it... click on start... bhoom your problem is resolved.. open cmd and check it