Search

6/28/2013

gett/mongojs

gett/mongojs - provides mongodb streaming api

Tailable cursors
# mycollection must by a capped collection
# http://docs.mongodb.org/manual/core/capped-collections/
var cursor = db.mycollection.find({}, {}, {tailable:true, timeout:false});

// since all cursors are streams we can just listen for data
cursor.on('data', function(doc) {
    console.log('new document', doc);
});

沒有留言: