0
votes

MongoDB shell version v4.4.3 connecting to: mongodb://127.0.0.1:27017/admin?compressors=disabled&gssapiServiceName=mongodb 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 :: No connection could be made because the target machine actively refused it. : connect@src/mongo/shell/mongo.js:374:17 @(connect):2:6 exception: connect failed exiting with code 1

I get this error when I try to run my mongo server, It has worked previously but not it doesn't. I have no idea what to do, please help.

2
Did you check the mongo log file?Wernfried Domscheit

2 Answers

0
votes

This error can come up for a couple reasons. If I were to begin troubleshooting this connection, I would try restarting the MongoDB service on your local computer; as it looks like you are trying to connect to a local instance of mongodb.

0
votes

The reason for this error is, you have stopped the mongodb server. Follow these steps to start mongodb server. First open task manager and go to the services tab. Then check the server status. If it is stopped, right click on it and start. enter image description here