mongodb Error: connect ECONNREFUSED 127.0.0.1:27017 code example

Example 1: connect ECONNREFUSED 127.0.0.1:27017

For windows - just go to Mongodb folder (ex : C:\ProgramFiles\MongoDB\Server\3.4\bin) and open cmd in the folder and type "mongod.exe --dbpath c:\data\db"

if c:\data\db folder doesn't exist then create it by yourself and run above command again.

All should work fine by now.))

Source stackoverflow

Example 2: Connection error: connect ECONNREFUSED 127.0.0.1:5432

database system is ready to accept connections

Tags:

Misc Example