Browse Source

mongo tail

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

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

@ -437,23 +437,18 @@ MongoClient.connect(mongourl, OPTS, function(err, client){
} else {
const db = client.db('fluent');
db.collection('logs', onCollection);
/*
var stream = db.collection('logs').find({}, {
tailable: true,
awaitdata: true
/* other options */
//other options
}).stream();
stream.on('data', function (doc) {
console.log('doc ' + JSON.stringify(doc))
//socket.write(JSON.stringify({'action': 'log','param': doc.log}));
});
/*
db.collection(function(err, collections) {
collections.forEach(function(coll) {
console.log(coll.s.name);
});
});
*/
}
});

Loading…
Cancel
Save