DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version
See original GitHub issueDo you want to request a feature or report a bug? bug (deprecation warning)
What is the current behavior? On start we have deprecation warning into console
If the current behavior is a bug, please provide the steps to reproduce.
(node:9455) DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version.
at _setClient (node_modules/mongoose/lib/connection.js:943:6)
at node_modules/mongoose/lib/connection.js:839:7
at node_modules/mongodb/lib/utils.js:693:5
at node_modules/mongodb/lib/mongo_client.js:227:7
at connectCallback (node_modules/mongodb/lib/operations/connect.js:366:5)
at node_modules/mongodb/lib/operations/connect.js:602:5
at Object.connectHandler [as callback] (/node_modules/mongodb/lib/core/sdam/topology.js:297:43)
at processWaitQueue (node_modules/mongodb/lib/core/sdam/topology.js:1048:21)
at NativeTopology.serverUpdateHandler (node_modules/mongodb/lib/core/sdam/topology.js:567:7)
at Server.emit (events.js:315:20)
What is the expected behavior? No deprecation warning What are the versions of Node.js, Mongoose and MongoDB you are using? Note that “latest” is not a version. Latest 5.11.16
I digged in into warning and found why this happens:
- This introduced into mongo driver on version v3.6.4 https://github.com/mongodb/node-mongodb-native/pull/2610 as part on preparation of driver v4 release
- Latest mongoose 5.11.16 introduced mongo drive update https://github.com/Automattic/mongoose/pull/9893
- Original change happens because of https://github.com/mongodb/node-mongodb-native/pull/2251
Issue Analytics
- State:
- Created 3 years ago
- Reactions:20
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Listening to events on the Db class has been deprecated and ...
(node:44612) DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version.
Read more >Listening to events on the Db class has been deprecated and ...
(node:44612) DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version.
Read more >Listening to events on the Db class has been deprecated and ...
I got some deprecation warning OS : macOS 11.2 Big Sur Monk : Latest 7.3.3 ... class has been deprecated and will be...
Read more >Listening to events on the Db class has been deprecated and ...
Node.js – DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version.
Read more >Mongoose v6.8.1: Deprecation Warnings
There are several deprecations in the MongoDB Node.js driver that Mongoose users should be aware of. Mongoose provides options to work around these ......
Read more >
Top Related Medium Post
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The warning still exists in mongoose 5.11.18:
how does this get fixed?