Fix MongoError on first connect

The default MongoDb port is 27017. An error occurs sometimes while I am running my Node & ExpressJS application, with the message:

message: 'failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]' }

Several solutions are provided on the internet to fix this. But a lot of them did not work for me. The simplest method I find to fix this on MS Windows is:

1. Open your Command Prompt as administrator.
2. Type > net start mongodb

The mongodb service starts successfully.

Leave a Reply

Follow

Get notified with the latest posts

Plugin Supporter WordPress Post Navigation
%d bloggers like this: