javascript - When Mongoose QueryStream emits an error event what is the state of the stream? -


i opening stream db through mongoose , know state of stream when emits error event? mean individual document being streamed had error , stream continue pipe data? or mean entire stream had error , stream corrupt/closed?

here sample code mongoose' docs:

var stream = model.find().stream();  stream.on('data', function (doc) {   // mongoose document }).on('error', function (err) {   // state stream here????? }).on('close', function () {   // stream closed }); 

for streams in general, 'error' event means stream has halted , won't emitting anymore 'data'.

emitting 'error' equivalent throw statement, breaks application flow. and, similar try...catch, .on('error') callback way of handling error.

with domains, 'error' may have been triggered throw.


Comments