MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
at _handleConnectionErrors (E:\code jour\6 program\socialapp\node_modules\mongoose\lib\connection.js:805:11)
at NativeConnection.openUri (E:\code jour\6 program\socialapp\node_modules\mongoose\lib\connection.js:780:11) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) { 'localhost:27017' => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined
}
database connected :
Asked
Active
Viewed 19 times
0

rickhg12hs
- 10,638
- 6
- 24
- 42
-
1Does this answer your question? [Can't connect to MongoDB 6.0 Server locally using Node.js driver](https://stackoverflow.com/questions/74609210/cant-connect-to-mongodb-6-0-server-locally-using-node-js-driver) – rickhg12hs Aug 27 '23 at 15:22
1 Answers
0
replace localhost with 127.0.0.1 in your mongodb connection string

Sanamdeep Kajla
- 1
- 1
-
You may also provide an explanation why this solves the problem. – Wernfried Domscheit Aug 27 '23 at 20:09