My Problem:
MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
at Connection.openUri (D:\website\Discord-OAuth2\node_modules\mongoose\lib\connection.js:819:32)
at D:\website\Discord-OAuth2\node_modules\mongoose\lib\index.js:377:10
at D:\website\Discord-OAuth2\node_modules\mongoose\lib\helpers\promiseOrCallback.js:32:5
at new Promise ()
at promiseOrCallback (D:\website\Discord-OAuth2\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:10)
at Mongoose._promiseOrCallback (D:\website\Discord-OAuth2\node_modules\mongoose\lib\index.js:1220:10)
at Mongoose.connect (D:\website\Discord-OAuth2\node_modules\mongoose\lib\index.js:376:20)
at Object. (D:\website\Discord-OAuth2\src\database\database.js:2:27)
at Module._compile (node:internal/modules/cjs/loader:1112:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1166:10) {
reason: TopologyDescription {
type: ‘Unknown’,
servers: Map(1) { ‘localhost:27017’ => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
logicalSessionTimeoutMinutes: undefined
},
code: undefined
}
My Code:
const mongoose = require(‘mongoose’);
module.exports = mongoose.connect(‘mongodb://localhost:27017/discordauth’,
{ useNewUrlParser: true});
Can someone help me?