You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version #333
OS : macOS 11.2 Big Sur
Monk : Latest 7.3.3
Mongodb : Latest 3.6.4
(node:58674) DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version.
at /Users/forte/Workspace/freejs/node_modules/monk/lib/manager.js:150:18
at Array.forEach (<anonymous>)
at Manager.<anonymous> (/Users/forte/Workspace/freejs/node_modules/monk/lib/manager.js:149:95)
at /Users/forte/Workspace/freejs/node_modules/mongodb/lib/utils.js:693:5
at /Users/forte/Workspace/freejs/node_modules/mongodb/lib/mongo_client.js:227:7
at connectCallback (/Users/forte/Workspace/freejs/node_modules/mongodb/lib/operations/connect.js:366:5)
at /Users/forte/Workspace/freejs/node_modules/mongodb/lib/operations/connect.js:602:5
at Object.connectHandler [as callback] (/Users/forte/Workspace/freejs/node_modules/mongodb/lib/core/sdam/topology.js:297:43)
at processWaitQueue (/Users/forte/Workspace/freejs/node_modules/mongodb/lib/core/sdam/topology.js:1048:21)
at NativeTopology.serverUpdateHandler (/Users/forte/Workspace/freejs/node_modules/mongodb/lib/core/sdam/topology.js:567:7)
at Server.emit (events.js:315:20)
at Server.EventEmitter.emit (domain.js:467:12)
at Monitor.<anonymous> (/Users/forte/Workspace/freejs/node_modules/mongodb/lib/core/sdam/server.js:151:12)
at Monitor.emit (events.js:327:22)
at Monitor.EventEmitter.emit (domain.js:467:12)
at /Users/forte/Workspace/freejs/node_modules/mongodb/lib/core/sdam/monitor.js:272:13
Reacted by Vincent Orback, mulf0, George Hindle, Dexter Marks-Barber, jeffalo, 강성우, Alessandro Farcas, Mustafa K..., Alexander Löhr, Yannick Meeus and 6 more
I have tried to install mongodb@3.6.5 and 3.6.6 but the deprecation warning still be exist..
And originally why I open the issue, I think this deprecation may cause problem in the next release if monk library is not patched / fixed
And I have found monk library also have own mongodb version. So which mongodb version that we install to our project, monk will use its own mongodb version
And I have found monk library also have own mongodb version. So which mongodb version that we install to our project, monk will use its own mongodb version
This is not how NPM works.
Monk specifies "mongodb": "^3.2.3",, which means any version of mongodb greater than or equal to 3.2.3, but NOT 4.x.x.
This means that if you explicitly install a version of mongodb in your project, monk will use that version of mongodb, provided that the version you install is after 3.2.3.
I solved this problem with silly solution, I had cloned monk library, downgrade mongodb to 3.6.3, and allow lib to be hosted on github. So I use the cloned monk on my project
It's a shame that we have not received any reply from the developers of this framework, stating how to resolve this issue or at least letting us know they are working on it.
It's a pain in the ass when you're debugging your program and all you see is that you're being spammed by these errors.
Someone, please tell me how to disable these errors, I don't care if they're just ignored or if the code is fixed, I JUST DONT WANT TO SEE THEM. Thanks.
Activity
mcasto commentedon Feb 18, 2021
Prompted to come here for this same issue.
cutratefuture commentedon Feb 19, 2021
https://stackoverflow.com/questions/66190532/deprecationwarning-listening-to-events-on-the-db-class-has-been-deprecated-and
TEMP Fix.
you must remove current mongoose version (I was on 5.11.13), and downgrade to mongoose@5.11.15, to resolve it.
zkldi commentedon Apr 13, 2021
This is fixed with mongodb version 3.6.5.
This can also be fixed with
npm i mongodb@3.6.3, as that version is before the bug occured.Given that this isn't an issue with monk and is resolved downstream, this is probably safe to close?
kasmanth commentedon Apr 13, 2021
I have tried to install mongodb@3.6.5 and 3.6.6 but the deprecation warning still be exist..
And originally why I open the issue, I think this deprecation may cause problem in the next release if monk library is not patched / fixed
And I have found monk library also have own mongodb version. So which mongodb version that we install to our project, monk will use its own mongodb version

zkldi commentedon Apr 14, 2021
This is not how NPM works.
Monk specifies
"mongodb": "^3.2.3",, which means any version of mongodb greater than or equal to 3.2.3, but NOT 4.x.x.This means that if you explicitly install a version of mongodb in your project, monk will use that version of mongodb, provided that the version you install is after 3.2.3.
kasmanth commentedon Apr 15, 2021
@zkldi
Please check it out this simple repo https://github.com/fortezhuo/monk_dummy
The repo only contains mongodb 3.6.3 and monk 7.3.3
I used to use yarn and found monk still use mongodb@3.6.6. I think the problem may be caused by yarn.
Yarn Version : 1.22.10
zkldi commentedon Apr 26, 2021
Strange, this has started breaking for me again. Nothing has changed with the versions installed, either.
zkldi commentedon Apr 26, 2021
Well, hm. Here's an uninteresting fix. If you:
npm install monknpm install mongodbnpm uninstall monknpm install monkThe errors do not appear. I have absolutely no idea how this fixes the problem, but uh, it does. Maybe NPM is doing some wacky cacheing.
kasmanth commentedon Apr 27, 2021
I solved this problem with silly solution, I had cloned monk library, downgrade mongodb to 3.6.3, and allow lib to be hosted on github. So I use the cloned monk on my project
JonasTheGamer commentedon May 8, 2021
Hi! I tried this but I'm still receiving the warning. I tried all other solutions above as well... Anyone who found a fix yet?
FranciscoMendes10866 commentedon Jun 25, 2021
I have exactly the same problem. Is there already a solution?
Black-Platypus commentedon Dec 9, 2021
Why isn't Monk just using the new paradigm?
https://www.mongodb.com/community/forums/t/node-44612-deprecationwarning-listening-to-events-on-the-db-class-has-been-deprecated-and-will-be-removed-in-the-next-major-version/15849/4
JonasTheGamer commentedon Jan 2, 2022
It's a shame that we have not received any reply from the developers of this framework, stating how to resolve this issue or at least letting us know they are working on it.
It's a pain in the ass when you're debugging your program and all you see is that you're being spammed by these errors.
Someone, please tell me how to disable these errors, I don't care if they're just ignored or if the code is fixed, I JUST DONT WANT TO SEE THEM. Thanks.
RogthatSinatra commentedon Apr 12, 2023
This worked for me. i almost collapsed fixing this bug