node.js - Cursor is not sending the updated data from mongoDB's Capped Collection? -
i trying read data "message" capped collection,
- what trying insert new data in collection through mongo console(or tool) want data shown @ node console not working.
- i tried iterate .foreach loop on collections showing .foreach not function.*i know stream deprecated using cursor having same problem.
thanks lot in advance :)
app.js var message=mongoose.model("message",messageschema); var cursor=message.find({}, {tailable:true, await_data:true, numberofretries:-1}, function(err,data){ if(err){console.log("error");} else{ console.log(data);} }); //iterating on collection cursor.cursor() .on('data', function(doc){ console.log(doc); }) .on('error', function(err){ // handle error }) .on('end', function(){ // final callback });
Comments
Post a Comment