question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DeprecationWarning: Listening to events on the Db class has been deprecated and will be removed in the next major version

See original GitHub issue

I got some deprecation warning

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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:15
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
JonasTheGamercommented, May 8, 2021

Well, hm. Here’s an uninteresting fix. If you:

  • install monk npm install monk
  • install mongodb@3.6.3, @3.6.5, or later deliberately npm install mongodb
  • uninstall monk npm uninstall monk
  • install monk npm install monk

The 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.

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?

0reactions
JonasTheGamercommented, 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.

Read more comments on GitHub >

github_iconTop 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 ...
Deprecation Warning Listening to events on the Db class has been deprecated and will be removed in the next major version. Fix: So...
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 >
listening to events on the db class has been deprecated and ...
1 You can downgrade mongodb to version 3.6.3 #2 Or downgrade mongoose from 5.11.16 back to 5.11.15: npm uninstall mongoose npm install mongoose@5.11.15...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found