From 4f67690c53e44c46c91a70c0dc46763cfe182edc Mon Sep 17 00:00:00 2001 From: zeus Date: Tue, 24 Nov 2020 17:02:56 +0200 Subject: [PATCH] mongo tail --- swarmlab-app/src/run/app.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index c4ba41a..7d00378 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -387,12 +387,16 @@ 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/?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" +//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) => { +var mongooptions = { + auth.user:"playgrounduser", + auth.password:'efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine' +} +MongoClient.connect(mongourl,mongooptions).then((client) => { const db = client.db('fluent'); db.collection('log', onCollection); // do database things