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);