Categories
JavaScript Answers

How to fix MongoError: connect ECONNREFUSED 127.0.0.1:27017 error in Node.js?

Spread the love

To fix MongoError: connect ECONNREFUSED 127.0.0.1:27017 error in Node.js, we should check that the connection string is correct.

For instance, we write

const uri = "mongodb://0.0.0.0:27017/";
const client = new MongoClient(uri);

to call MongoClient with the uri connection string to make the connection to MongoDB.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *