"deprecationwarning: listening to events on the db class has been deprecated and will be removed in the next major version" Code Answer

3

update

mongodb@3.6.5 is out.

just update mongodb driver and mongoose:

npm i mongodb mongoose

this is caused by the mongodb@3.6.4 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 mongoose@5.11.15

#3 or just wait for the release of mongodb@3.6.5.

By Alan Gaytan on April 25 2022

Answers related to “deprecationwarning: listening to events on the db class has been deprecated and will be removed in the next major version”

Only authorized users can answer the Search term. Please sign in first, or register a free account.