MongoDB is not connected Mongoose ServerSelectionError connect ECONNREFUSED ::1:2701721 Dec 2022
MongoDB is not connected MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
This is the error we get when we try to connect to localhost MongoDB on Windows/Linus/Mac OS.
MongoDB is not connected MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 Soloution
You have to replace "localhost" by the address of localhost.
const mongoDB = "mongodb://localhost:27017/mongooseFirstDatabase"
const mongoDB = "mongodb://127.0.0.1:27017/mongooseFirstDatabase"
You can see the change in image below.
Finally the mongodb is connected
What is Mongodb
MongoDB is a cross-platform document-oriented database application that is open source. MongoDB, a NoSQL database application, uses documents that resemble JSON and may or may not include schemas. MongoDB was created by MongoDB Inc. and is distributed under the Server Side Public License, which some distributions consider to be non-free.
What is Mongoose
Back to Home Page