Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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");
})
 
PREVIOUS NEXT
Tagged: #connect #ECONNREFUSED
ADD COMMENT
Topic
Name
3+1 =