Browse Source

mongo tail

master
zeus 4 years ago
parent
commit
ccba523f20
  1. 11
      swarmlab-app/src/run/app.js

11
swarmlab-app/src/run/app.js

@ -374,12 +374,13 @@ function onCollection(err, collection) {
numberOfRetries: -1, numberOfRetries: -1,
tailableRetryInterval: 500 tailableRetryInterval: 500
}; };
//collection.find().cursor(options); var cursor = collection.find().cursor(options);
var cursor = collection.find({}, options), //var cursor = collection.find({}, options),
cursorStream = cursor.stream(), // cursorStream = cursor.stream(),
itemsProcessed = 0; // itemsProcessed = 0;
cursorStream.on('data', function (data) { //cursorStream.on('data', function (data) {
cursor.on('data', function (data) {
console.log(data.value); console.log(data.value);
itemsProcessed++; itemsProcessed++;
}); });

Loading…
Cancel
Save