From faaf1347775be0752c6ab7d943fff786eada1938 Mon Sep 17 00:00:00 2001 From: zeus Date: Tue, 24 Nov 2020 16:57:52 +0200 Subject: [PATCH] mongo tail --- swarmlab-app/src/run/app.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index fe025db..c4ba41a 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -387,12 +387,14 @@ function onCollection(err, collection) { // db.collection('log', onCollection); //} -var mongourl = "mongodb://playgrounduser:efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/fluent?replicaSet=rs1" +var mongourl = "mongodb://playgrounduser:efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/?replicaSet=rs1" +//var mongourl = "mongodb://ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/?replicaSet=rs1" //MongoClient.connect(mongourl, options).then((client) => { +//MongoClient.connect("mongodb://member1,member2,member3/database", function(err,db) { +//}) MongoClient.connect(mongourl).then((client) => { - //const db = client.db('fluent'); - //db.collection('log', onCollection); - client.collection('log', onCollection); + const db = client.db('fluent'); + db.collection('log', onCollection); // do database things }).catch((error) => { console.log("connect_error_mongo " +JSON.stringify(error))