Automattic / Automattic/monk

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

Open
#333 14 comments 16 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.8k
Forks
180
PR merge metrics
No merged PRs in 30d

Description

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 ()
at Manager. (/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. (/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
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting lib/manager.js around lines 149-150, where the stack trace shows Monk listening for events on the Db class. Reproduce the warning with Monk 7.3.3 and MongoDB 3.6.4, then verify that the deprecation warning no longer appears while the relevant event behavior still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.