Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

MongoServerSelectionError: connect ECONNREFUSED ::1:27017

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

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

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");
})
Comment

(node:15855) UnhandledPromiseRejectionWarning: MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017

mongodb://localhost:27017/{DATABASE_NAME}
Comment

MongooseServerSelectionError: 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.
Comment

MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017

Check if you've installed mongoDB by running "mongod" in your terminal
Comment

PREVIOUS NEXT
Code Example
Javascript :: history react router 
Javascript :: how to add css based on route react 
Javascript :: arcgis for javascript 
Javascript :: what is event loop in javascript 
Javascript :: js update query string without refresh 
Javascript :: how to use brand icons in react 
Javascript :: window frames js 
Javascript :: named parameters 
Javascript :: google pay in react js 
Javascript :: javascript weakset 
Javascript :: how to build and deploy a react app to github pages 
Javascript :: javascript test cases 
Javascript :: arrow functions syntax 
Javascript :: arrow function in es6 
Javascript :: calling javascript from java 
Javascript :: map values in range js 
Javascript :: set visible vue 
Javascript :: enhanced object literals in es6 
Javascript :: sorting the object 
Javascript :: gsap react 
Javascript :: array of 
Javascript :: word table to json 
Javascript :: hoisting in javascript mdn 
Javascript :: remove duplicates strig javascript 
Javascript :: json html 
Javascript :: javascript set query parameters in url 
Javascript :: javascript best online game engine 
Javascript :: node md5 decrypt 
Javascript :: Angular JS Interpolation 
Javascript :: javascript static class variable 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =