Skip to content

Instantly share code, notes, and snippets.

@iworkforthem
Created October 2, 2017 07:24
Show Gist options
  • Save iworkforthem/fddbd5495069e9a3d64f15a2a87680cf to your computer and use it in GitHub Desktop.
Save iworkforthem/fddbd5495069e9a3d64f15a2a87680cf to your computer and use it in GitHub Desktop.
mongoose tailable cursor
var Job = require('./model/job');
var cursor = Job.find({}).tailable().cursor();
cursor.on('data', function(doc) {
// Called once for every document
console.log(doc)
});
cursor.on('close', function(done) {
// Called when done
console.log(done)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment