“MongooServerSelectionError: Econnrefused :: 1: 27017 anschließen” Code-Antworten

MongoServerSelectionError: Econnrefused :: 1: 27017 anschließen

// instead of this
const url = "mongodb://localhost:27017";

// Just Replace
const url = "mongodb://0.0.0.0:27017";
Lively Lyrebird

MongooServerSelectionError: Econnrefused :: 1: 27017 anschließen

// Try using 127.0.0.1 instead of localhost in connection url
// mongodb://localhost:27017
// mongodb://127.0.0.1:27017

const mongoose = require('mongoose');

mongoose.connect('mongodb://127.0.0.1:27017').then(() => {
    console.log("connected to database");
})
Heartho De La Huracan

(Knoten: 15855) UnbekandeltePromisereignereWarning: MongooServerSelectionError: Econnrefused 127.0.0.1:27017 verbinden

mongodb://localhost:27017/{DATABASE_NAME}
Outstanding Okapi

MongooServerSelectionError: Econnrefused 127.0.0.1:27017 verbinden

This happened probably because the MongoDB service isn't started. Follow the below steps to start it:

Go to Control Panel and click on Administrative Tools.
Double click on Services. A new window opens up.
Search MongoDB.exe. Right click on it and select Start.
The server will start. Now execute npm start again and the code might work this time.
stacklord

Ähnliche Antworten wie “MongooServerSelectionError: Econnrefused :: 1: 27017 anschließen”

Fragen ähnlich wie “MongooServerSelectionError: Econnrefused :: 1: 27017 anschließen”

Weitere verwandte Antworten zu “MongooServerSelectionError: Econnrefused :: 1: 27017 anschließen” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen