DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version
This is caused by the [email protected] native driver which is used by mongoose.
#1 You can downgrade mongodb to version 3.6.3 (described here).
#2 Or downgrade mongoose from 5.11.16 back to 5.11.15:
npm uninstall mongoose
npm install [email protected]
#3 Or just wait for the release of [email protected].
Same Error
But As far as I know its a new version compatibility bug, after searching about this current bug version, I found this comment session and according to one of them, it is safe to ignore this warning.
For all those looking for an answer for this, there is a question posted on Mongodb forum and the answer is acknowledged by Mongodb concerned person.
The answer given by @kmgt is correct. The error can be ignored safely and will be fixed in upcoming release of Mongodb Nodejs driver or downgrading Mongoose version to 5.11.15 will help.
(node:44612) DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version