From 0cdef2db8b276e21c4f3b858e9f0a9f05c7f464d Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 31 Aug 2022 23:19:34 +0300 Subject: [PATCH] fix --- src/structure/storage/providers/Mongodb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structure/storage/providers/Mongodb.js b/src/structure/storage/providers/Mongodb.js index c0ab2c1..33fc470 100644 --- a/src/structure/storage/providers/Mongodb.js +++ b/src/structure/storage/providers/Mongodb.js @@ -11,10 +11,10 @@ class MongoDBProvider extends Provider { }); const { MONGODB_HOST, MONGODB_USERNAME, MONGODB_PASSWORD, MONGODB_DATABASE } = process.env; - const database = MONGODB_DATABASE; + this.database = MONGODB_DATABASE; // const { database } = this.config; const auth = MONGODB_USERNAME ? `${MONGODB_USERNAME}:${MONGODB_PASSWORD}@`:''; - this.URI = `mongodb://${auth}${MONGODB_HOST}/${database}?authSource=${database}`; + this.URI = `mongodb://${auth}${MONGODB_HOST}/${this.database}?authSource=${this.database}`; } @@ -22,7 +22,7 @@ class MongoDBProvider extends Provider { try { this.connection = await MongoClient.connect(this.URI, { useNewUrlParser: true }); - this.db = await this.connection.db(this.config.database); + this.db = await this.connection.db(this.database); return this._initialized = true; //eslint-disable-line no-return-assign } catch (err) { this._error(err);