Innotechzz

Innotechzz

MongoDB is not connected

MongoDB is not connected Mongoose ServerSelectionError connect ECONNREFUSED ::1:27017

21 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


MongoDB is not connected

You have to replace "localhost" by the address of localhost.
Before Code:-
const mongoDB = "mongodb://localhost:27017/mongooseFirstDatabase"

After Code:-
const mongoDB = "mongodb://127.0.0.1:27017/mongooseFirstDatabase"
You can see the change in image below.


MongoDB is not connected

Finally the mongodb is connected


MongoDB is not 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


Mongoose is a JavaScript object-oriented programming library that creates a connection between MongoDB and the Node.js JavaScript runtime environment.



Back to Home Page

  • Tags:
  • MongoDB error,
  • MongoDB,
  • MongoDB not connected