node.js - Tailable cursor closing when reaching end of collection -
i attempting stream data mongodb capped collection follows:
var query = {}; var options = {tailable: true, awaitdata: true, numberofretries: number.max_value}; var stream = mycoll.find(query, options).stream(); stream.on('data', function(doc){ console.log(doc); }).on('error', function (error){ console.log(error); }).on('close', function () { console.log('closed'); });
this prints documents expected upon reaching end of collection stream closes. possible prevent happening? looking have program print data arrives in collection, waiting @ end of collection indefinitely more data.
solved problem. turns out issue wasn't formatting options correctly.
mycoll.find().tailable(true, { awaitdata: true ,numberofretries: number.max_value}).stream();
is correct , works expected.
Comments
Post a Comment