Created
October 2, 2017 07:24
-
-
Save iworkforthem/fddbd5495069e9a3d64f15a2a87680cf to your computer and use it in GitHub Desktop.
mongoose tailable cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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