const mongoose = require("mongoose");
mongoose.set("strictQuery", true);
mongoose.connect("mongodb://localhost:27017/", (err) => {
if (!err) {
console.log(" db connected successfully");
}
else {
console.log(" db error" + JSON. stringify (err, undefined, 2));
}
});
module.exports = mongoose;
this is my db.js file I am getting this error
error{
"message": "connect ECONNREFUSED ::1:27017",
"reason": {
"type": "Unknown",
"servers": {},
"stale": false,
"compatible": true,
"heartbeatFrequencyMS": 10000,
"localThresholdMS": 15,
"setName": null,
"maxElectionId": null,
"maxSetVersion": null,
"commonWireVersion": 0,
"logicalSessionTimeoutMinutes": null
}
}