From a0263e7f5cb95e202346742079cc7f5497c61add Mon Sep 17 00:00:00 2001 From: Dan Aprahamian Date: Wed, 29 Nov 2017 15:47:40 -0500 Subject: [PATCH] fix(changeStreams): fixing node4 issue with util.inherits 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;