From ccba523f20abe2b58708f32c27610aa46aa770f9 Mon Sep 17 00:00:00 2001 From: zeus Date: Tue, 24 Nov 2020 18:39:37 +0200 Subject: [PATCH] mongo tail --- swarmlab-app/src/run/app.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index e2d1c8c..f2b4b0a 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -374,12 +374,13 @@ function onCollection(err, collection) { numberOfRetries: -1, tailableRetryInterval: 500 }; - //collection.find().cursor(options); - var cursor = collection.find({}, options), - cursorStream = cursor.stream(), - itemsProcessed = 0; + var cursor = collection.find().cursor(options); + //var cursor = collection.find({}, options), + // cursorStream = cursor.stream(), + // itemsProcessed = 0; - cursorStream.on('data', function (data) { + //cursorStream.on('data', function (data) { + cursor.on('data', function (data) { console.log(data.value); itemsProcessed++; });