|
@ -387,16 +387,40 @@ function onCollection(err, collection) { |
|
|
// db.collection('log', onCollection);
|
|
|
// 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://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://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 mongolab_uri = "mongodb://<dbUser>:<dbPassword>@<host1>:<port1>,<host2>:<port2>/<dbName>?replicaSet=<replicaSetName>";
|
|
|
//MongoClient.connect(mongourl, options).then((client) => {
|
|
|
|
|
|
//MongoClient.connect("mongodb://member1,member2,member3/database", function(err,db) {
|
|
|
|
|
|
//})
|
|
|
|
|
|
var mongooptions = { |
|
|
var mongooptions = { |
|
|
auth.user:"playgrounduser", |
|
|
server: { |
|
|
auth.password:'efvvnuioervefSDFSGYGHRDFVsdfergvssppiiedifhwincvinviw_dbfjbsifbsdkjfswuunscfudfgbbfvibqefwrvnine' |
|
|
socketOptions: { |
|
|
|
|
|
autoReconnect: true, |
|
|
|
|
|
keepAlive: 1, |
|
|
|
|
|
connectTimeoutMS: 30000, |
|
|
|
|
|
socketTimeoutMS: 0 |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
replSet: { |
|
|
|
|
|
socketOptions: { |
|
|
|
|
|
keepAlive: 1, |
|
|
|
|
|
connectTimeoutMS: 30000, |
|
|
|
|
|
socketTimeoutMS: 0 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
MongoClient.connect(mongourl,mongooptions).then((client) => { |
|
|
MongoClient.connect(mongourl, mongooptions, function(err, db){ |
|
|
|
|
|
if(err){ |
|
|
|
|
|
console.log(err); |
|
|
|
|
|
} else { |
|
|
|
|
|
db.collections(function(err, collections) { |
|
|
|
|
|
collections.forEach(function(coll) { |
|
|
|
|
|
console.log(coll.s.name); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//MongoClient.connect(mongourl,mongooptions).then((client) => {
|
|
|
|
|
|
/* |
|
|
|
|
|
MongoClient.connect(mongourl).then((client) => { |
|
|
const db = client.db('fluent'); |
|
|
const db = client.db('fluent'); |
|
|
db.collection('log', onCollection); |
|
|
db.collection('log', onCollection); |
|
|
// do database things
|
|
|
// do database things
|
|
@ -404,7 +428,7 @@ MongoClient.connect(mongourl,mongooptions).then((client) => { |
|
|
console.log("connect_error_mongo " +JSON.stringify(error)) |
|
|
console.log("connect_error_mongo " +JSON.stringify(error)) |
|
|
// handle connection errors
|
|
|
// handle connection errors
|
|
|
}); |
|
|
}); |
|
|
|
|
|
*/ |
|
|
io.on('connection', s => { |
|
|
io.on('connection', s => { |
|
|
console.error('socket connection'); |
|
|
console.error('socket connection'); |
|
|
|
|
|
|
|
|