Skip to content
Sign upLog in
← Back to Community

Mongodb does not connect to port

Profile icon
sojs
var MongoClient = require('mongodb').MongoClient; var url = "mongodb://localhost:27017/mydb"; MongoClient.connect(url, function(err, db) {   if (err) throw err });

Results in:
Process crashed with: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]

Can anybody explain why it does not connect to the port?

Voters
Profile icon
MarcoPipes
Profile icon
Ray21671
Profile icon
yoba1
Profile icon
kaptcha
Profile icon
Pythonier
Profile icon
sojs