[Fixed] MongoDB, NodeJs. No connection could be made because the target machine actively refused it. :

Issue

I am trying to connect to my MongoDB database in localhost. While I type mongo in command shell I am getting an error in the command shell:

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 :: No connection could be made because the target machine actively refused it. :
[email protected]/mongo/shell/mongo.js:341:17

Solution

command mongod will run the MongoDB server using the default configuration. You can change these configurations by locating the default path of the configuration files.

Leave a Reply

(*) Required, Your email will not be published