core db optimisation
This commit is contained in:
1 parent
9925d4dc8b
commit
01b9064700
1 file changed
+3
@@ -13,6 +13,9 @@ const { MongoClient, ObjectId } = require('mongodb')
|
|||||||
var db
|
var db
|
||||||
|
|
||||||
async function connect() {
|
async function connect() {
|
||||||
|
if (db) {
|
||||||
|
return db
|
||||||
|
}
|
||||||
const mongoUri = getConfig().serverRuntimeConfig.dbUri
|
const mongoUri = getConfig().serverRuntimeConfig.dbUri
|
||||||
const connection = await MongoClient.connect(mongoUri)
|
const connection = await MongoClient.connect(mongoUri)
|
||||||
db = init(connection)
|
db = init(connection)
|
||||||
|
|||||||
Reference in new issue
Block a user