Hello,
I think listeners are not working for me.
When I put this code in program
(async () => {
await mongoose.connect(DBTOKEN).then(() => {
console.log("Connected to Database");
}).catch((err) => {
console.log("Not Connected to Database ERROR! ", err);
});
})();
I’m getting Connected to Database. But when I use
mongoose.connection.on("connected",......
mongoose.connection.on("err",.....
I’m getting nothing.