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 :: wordpress load latest jQuery 
Javascript :: iterate through list javascript 
Javascript :: node.js f string 
Javascript :: mongoose id from string 
Javascript :: on click button change route next js 
Javascript :: datatable giving default width to colums 
Javascript :: javascript if has jquery loaded 
Javascript :: es6 remove empty property from object 
Javascript :: convert to array str js 
Javascript :: Calling MVC controller from Javascript ajax 
Javascript :: javascript pushstate 
Javascript :: send refresh token in axios interceptor 
Javascript :: Codewars JS Multiples of 3 or 5 
Javascript :: convert string in ethers.js 
Javascript :: discordjs eval 
Javascript :: get children jquery index 
Javascript :: string to array javascript 
Javascript :: react import css only for component 
Javascript :: get last element in an array jqury 
Javascript :: cosnsole.log without obj object 
Javascript :: js get id value 
Javascript :: javascript validate email 
Javascript :: jquery on click function 
Javascript :: adonis hasone 
Javascript :: Jquery handle change event of file upload created dynamically 
Javascript :: get combinations of two js 
Javascript :: Node.js get cpus 
Javascript :: javascript hashtag url 
Javascript :: javascript regex check phone number 
Javascript :: create array with number js 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =