From 168bb3d78c878fd9e8efa2e7ed8a18e87ac45c02 Mon Sep 17 00:00:00 2001 From: daprahamian Date: Wed, 29 Nov 2017 16:33:59 -0500 Subject: [PATCH] fix(changeStreams): fixing node4 issue with util.inherits (#1587) require('util').inherits(ctor, super) blows away the original prototype of ctor. If we wish to use it, we need to move the inherits call to directly after the constructor creation. In the future, we should switch to using classes. --- lib/change_stream.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/change_stream.js b/lib/change_stream.js index 4233c35837..0c0f5337fa 100644 --- a/lib/change_stream.js +++ b/lib/change_stream.js @@ -71,6 +71,8 @@ var ChangeStream = function(collection, pipeline, options) { }); }; +inherits(ChangeStream, EventEmitter); + // Create a new change stream cursor based on self's configuration var createChangeStreamCursor = function(self) { if (self.resumeToken) { @@ -354,6 +356,4 @@ var processNewChange = function(self, err, change, callback) { * @param {(object|null)} result The result object if the command was executed successfully. */ -inherits(ChangeStream, EventEmitter); - module.exports = ChangeStream;