|
|
|
@ -301,20 +301,23 @@ exports.postgresQuery = function (connectionString, query) {
|
|
|
|
|
* @returns {Promise<(string[]|Object[]|Object)>}
|
|
|
|
|
*/
|
|
|
|
|
exports.mongodbPing = async function (connectionString) {
|
|
|
|
|
let client, db;
|
|
|
|
|
let client;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
client = await MongoClient.connect(connectionString, {useNewUrlParser: true})
|
|
|
|
|
db = client.db();
|
|
|
|
|
dbping = await db.command({ ping: 1 });
|
|
|
|
|
client = await MongoClient.connect(connectionString, { useNewUrlParser: true });
|
|
|
|
|
let db = client.db();
|
|
|
|
|
let dbping = await db.command({ ping: 1 });
|
|
|
|
|
await client.close();
|
|
|
|
|
if (dbping["ok"] === 1) {
|
|
|
|
|
return 'UP'
|
|
|
|
|
return "UP";
|
|
|
|
|
} else {
|
|
|
|
|
throw Error("failed");
|
|
|
|
|
}
|
|
|
|
|
throw Error("failed");
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err);
|
|
|
|
|
throw Error(err)
|
|
|
|
|
}
|
|
|
|
|
catch(err){ console.error(err); }
|
|
|
|
|
finally{ client.close(); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Query radius server
|
|
|
|
|