Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-2172

Change stream breaks on disconnection when there's something piped into it.

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.3, 4.0.0
    • Affects Version/s: 3.3.2
    • Component/s: None
    • Labels:

      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

            Assignee:
            thomas.reggi@mongodb.com Thomas Reggi (Inactive)
            Reporter:
            sunrize531@gmail.com Ivan Filimonov
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: