You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After I update my operating system and MongoDB I am started to get error while trying to connect to local MongoDB server.
MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 at NativeConnection.Connection.openUri (.../node_modules/mongoose/lib/connection.js:797:32) at .../node_modules/mongoose/lib/index.js:332:10 at .../node_modules/mongoose/lib/helpers/promiseOrCallback.js:32:5 at new Promise (<anonymous>) at promiseOrCallback (.../node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:10) at Mongoose._promiseOrCallback (.../node_modules/mongoose/lib/index.js:1158:10) at Mongoose.connect (.../node_modules/mongoose/lib/index.js:331:20) at Object.<anonymous> (.../app.js:45:10) at Module._compile (node:internal/modules/cjs/loader:1097:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10) { reason: TopologyDescription { type: 'Unknown', servers: Map(1) { 'localhost:27017' => [ServerDescription] }, stale: false, compatible: true, heartbeatFrequencyMS: 10000, localThresholdMS: 15, logicalSessionTimeoutMinutes: undefined } }
This is URL that I am using to connect to db: mongodb://localhost:27017/dbname
Also, when I try same URL in MongoDB Compass, everything works without problem.
I found out that when I change localhost to 17.0.0.1 it works perfect. I am note sure what causing this, but localhost should be same as 127.0.0.1. I tough fist that is problem with MongoDB server listening, but if that's case, it wouldn't be working from Compass too.
Versions:
Node: v17.1.0
MongoDB: 5.0.4
Mongoose: 6.1.0
The text was updated successfully, but these errors were encountered:
Start your MongoDB server with ipv6 support, or take a look at your /etc/hosts file and look for a line that looks like ::1 localhost. Make sure that ::1 localhost is after127.0.0.1 localhost. The ::1:27017 part of your stack trace makes it look like localhost is getting resolved to an ipv6 address.
vkarpov15
added
the
help
This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary
label
Dec 12, 2021
After I update my operating system and MongoDB I am started to get error while trying to connect to local MongoDB server.
MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 at NativeConnection.Connection.openUri (.../node_modules/mongoose/lib/connection.js:797:32) at .../node_modules/mongoose/lib/index.js:332:10 at .../node_modules/mongoose/lib/helpers/promiseOrCallback.js:32:5 at new Promise (<anonymous>) at promiseOrCallback (.../node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:10) at Mongoose._promiseOrCallback (.../node_modules/mongoose/lib/index.js:1158:10) at Mongoose.connect (.../node_modules/mongoose/lib/index.js:331:20) at Object.<anonymous> (.../app.js:45:10) at Module._compile (node:internal/modules/cjs/loader:1097:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10) { reason: TopologyDescription { type: 'Unknown', servers: Map(1) { 'localhost:27017' => [ServerDescription] }, stale: false, compatible: true, heartbeatFrequencyMS: 10000, localThresholdMS: 15, logicalSessionTimeoutMinutes: undefined } }
This is URL that I am using to connect to db: mongodb://localhost:27017/dbname
Also, when I try same URL in MongoDB Compass, everything works without problem.
I found out that when I change localhost to 17.0.0.1 it works perfect. I am note sure what causing this, but localhost should be same as 127.0.0.1. I tough fist that is problem with MongoDB server listening, but if that's case, it wouldn't be working from Compass too.
Versions:
The text was updated successfully, but these errors were encountered: