Cannot connect to the database! MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
at NativeConnection.Connection.openUri (C:\Users\PHILIP\Desktop\OTHER-FOLDER\express-mongo\express-mongo\node_modules\mongoose\lib\connection.js:819:32)
at C:\Users\PHILIP\Desktop\OTHER-FOLDER\express-mongo\express-mongo\node_modules\mongoose\lib\index.js:379:10
at C:\Users\PHILIP\Desktop\OTHER-FOLDER\express-mongo\express-mongo\node_modules\mongoose\lib\helpers\promiseOrCallback.js:32:5
at new Promise ()
at promiseOrCallback (C:\Users\PHILIP\Desktop\OTHER-FOLDER\express-mongo\express-mongo\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:10)
at Mongoose._promiseOrCallback (C:\Users\PHILIP\Desktop\OTHER-FOLDER\express-mongo\express-mongo\node_modules\mongoose\lib\index.js:1224:10)
at Mongoose.connect (C:\Users\PHILIP\Desktop\OTHER-FOLDER\express-mongo\express-mongo\node_modules\mongoose\lib\index.js:378:20)
at Object. (C:\Users\PHILIP\Desktop\OTHER-FOLDER\express-mongo\express-mongo\server.js:19:4)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) { 'localhost:27017' => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
logicalSessionTimeoutMinutes: undefined
},
code: undefined
}
Asked
Active
Viewed 65 times
-1
-
Show your code... Are you running mongo in a command prompt somewhere? – Reinier68 Jul 26 '22 at 14:15
-
No, I downloaded mongo compass. Trying to connect to it. the console throws that error – Philip Morningstar Jul 26 '22 at 14:19
-
Does this answer your question? [MongooseServerSelectionError: connect ECONNREFUSED ::1:27017](https://stackoverflow.com/questions/69840504/mongooseserverselectionerror-connect-econnrefused-127017) – bogdanoff Jul 26 '22 at 14:22
-
that's the mongo error.. – Philip Morningstar Jul 26 '22 at 14:36
1 Answers
0
Hey Philip i also faced the same issue.. To solve this i tried to open mongod.exe application from C://programfiles/mongodb////bin/mongod.exe..
If this work for you also then make shortcut of it on the screen. Thanks

Varun Kaklia
- 366
- 4
- 9