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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -