“MongoserverselectionerRor: Connect EconnRefused :: 1: 27017” Kod odpowiedzi

MongoserverselectionerRor: Connect EconnRefused :: 1: 27017

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

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

MongooseserverselectionerRor: Connect EconnRefused :: 1: 27017

// 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

NPM ERR! Błąd: Połącz EconnRefused

npm config set proxy null
npm config set https-proxy null
npm config set registry http://registry.npmjs.org/
Lucky Lark

(Węzeł: 15855) BezpromiserectionWarning: MongooseserverselectionerRor: Connect EconnRefused 127.0.0.1:27017

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

MongoosesServerselectionerRor: Connect EconnRefused 127.0.0.1:27017

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

Odpowiedzi podobne do “MongoserverselectionerRor: Connect EconnRefused :: 1: 27017”

Pytania podobne do “MongoserverselectionerRor: Connect EconnRefused :: 1: 27017”

Więcej pokrewnych odpowiedzi na “MongoserverselectionerRor: Connect EconnRefused :: 1: 27017” w JavaScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu