Add check client
This commit is contained in:
parent
9521494add
commit
502de9b05a
1 changed files with 3 additions and 1 deletions
|
|
@ -6,7 +6,9 @@ let db;
|
|||
module.exports = {
|
||||
connectToServer: function( callback ) {
|
||||
MongoClient.connect( uri, { useNewUrlParser: true, useUnifiedTopology: true }, function( err, client ) {
|
||||
console.log('mongodb-authentication-checkConnection'+client.isConnected());
|
||||
if(err) throw err;
|
||||
console.log('mongodb-authentication-checkConnection'+client===undefined);
|
||||
if (client !== undefined) console.log(client.isConnected());
|
||||
db = client.db(config.mongodbDatabase);
|
||||
|
||||
return callback( err );
|
||||
|
|
|
|||
Reference in a new issue