When tried to connect to MongoDB server, recieved the error: “MongoDB exception: connect failed”. This error occurs if MongoDB server is offline or It may be connecting with default port 27017.
MongoDB shell version v4.0.10
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-07-09T22:18:34.660-0700 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed
Reason:
Possible reason check the MongoDB server is up and running fine or not. In my case this error came because MongoDB server is down.
Solution 1:
Continue reading MongoDB exception: connect failed