Skip to content

Commit 168bb3d

Browse files
authored
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.
1 parent f4c1b56 commit 168bb3d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/change_stream.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ var ChangeStream = function(collection, pipeline, options) {
7171
});
7272
};
7373

74+
inherits(ChangeStream, EventEmitter);
75+
7476
// Create a new change stream cursor based on self's configuration
7577
var createChangeStreamCursor = function(self) {
7678
if (self.resumeToken) {
@@ -354,6 +356,4 @@ var processNewChange = function(self, err, change, callback) {
354356
* @param {(object|null)} result The result object if the command was executed successfully.
355357
*/
356358

357-
inherits(ChangeStream, EventEmitter);
358-
359359
module.exports = ChangeStream;

0 commit comments

Comments
 (0)