Skip to content

Commit 66dcfea

Browse files
authored
refactor: deprecate Db.on and Db.once
Deprecates methods inherited from EventEmitter, Db.on and Db.once, which have been removed in 4.0. NODE-1726
1 parent 86ae813 commit 66dcfea

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/db.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ function Db(databaseName, topology, options) {
211211

212212
inherits(Db, EventEmitter);
213213

214+
Db.prototype.on = deprecate(function() {
215+
return Db.super_.prototype.on.apply(this, arguments);
216+
}, 'Listening to events on the Db class has been deprecated and will be removed in the next major version.');
217+
218+
Db.prototype.once = deprecate(function() {
219+
return Db.super_.prototype.once.apply(this, arguments);
220+
}, 'Listening to events on the Db class has been deprecated and will be removed in the next major version.');
221+
214222
// Topology
215223
Object.defineProperty(Db.prototype, 'topology', {
216224
enumerable: true,

0 commit comments

Comments
 (0)