Standard way of streaming appears to not work under Mongoose 4.4.2:
var stream = someModel.aggregate([]).batchSize(100).stream()
It throws both on batchSize
and stream
, saying they are undefined.
However the following seems to work:
var stream = someModel.aggregate([]).cursor({ batchSize: 100 }).exec();
It appears to behave in a similar way. Is this the right way to stream results from .aggregate()
?
No dear, you cannot directly create a bulk/batch you have to get some wrapper/transporter like cursor (as you already mentioned it). And it's the right way you're doing var stream = someModel.aggregate([]).cursor({ batchSize: 100 }).exec();
Thanks & Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With