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

npm ERR! Error: connect ECONNREFUSED

npm config set proxy null
npm config set https-proxy null
npm config set registry http://registry.npmjs.org/
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 :: how to make chart js from zero 
Javascript :: node dotenv 
Javascript :: javascript loop with delay 
Javascript :: javscript .split().reverse.joni 
Javascript :: js string search 
Javascript :: how to communicate between nodejs applications 
Javascript :: json opposite of stringify 
Javascript :: react-native shadow generator 
Javascript :: how 2 subtract 2 dates using moment.js 
Javascript :: how to give a label padding through jquery 
Javascript :: tolocaletimestring short 
Javascript :: comment p5js 
Javascript :: js replace all number 
Javascript :: js remove quotes from string 
Javascript :: react-dom.development.js:86 Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. 
Javascript :: speed facebook video with js 
Javascript :: regex validate link 
Javascript :: map through keys javascript 
Javascript :: check balance of a wallet in js 
Javascript :: how to select data attribute in javascript using queryselectorAll 
Javascript :: random js 
Javascript :: settimestamp discord.js 
Javascript :: react router 404 redirect 
Javascript :: empty the value of an input in jquery 
Javascript :: Return the Next Number from the Integer Passed javascript 
Javascript :: javascript date to hours minutes seconds 
Javascript :: js add seconds to current time 
Javascript :: next js tailwind 
Javascript :: javascript truthy switch 
Javascript :: check if date is valid 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =