-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.3.2
-
Component/s: None
-
Empty show more show less
Repro steps:
1. Create a change stream.
2. Pipe writable stream into it.
3. Shut down db or force election on replset.
The exception will look like:
_stream_readable.js:582
dest.on('unpipe', onunpipe);
^
TypeError: dest.on is not a function
at ChangeStreamCursor.Readable.pipe (_stream_readable.js:582:8)
at createChangeStreamCursor (.\node_modules\mongodb\lib\change_stream.js:426:20)
at err (.\mongodb\lib\change_stream.js:506:33)
at Timeout.setTimeout [as _onTimeout] (.\node_modules\mongodb\lib\change_stream.js:453:58)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
Happens because of using "in" instead of "of" here cause it iterates through array's keys ["1", "2", ...]:
https://github.com/mongodb/node-mongodb-native/blob/v3.3.2/lib/change_stream.js#L425