fix(core): update

This commit is contained in:
2020-10-19 16:44:28 +00:00
parent 8b6c26f45a
commit fbdde2268c
4 changed files with 12 additions and 11 deletions

View File

@ -3,9 +3,12 @@ import { SmartdataCollection } from './smartdata.classes.collection';
import { SmartdataDb } from './smartdata.classes.db';
export class CollectionFactory {
public collections: {[key: string]: SmartdataCollection<any>} = {};
public collections: { [key: string]: SmartdataCollection<any> } = {};
public getCollection = (nameArg: string, dbArg: SmartdataDb | (() => SmartdataDb)): SmartdataCollection<any> => {
public getCollection = (
nameArg: string,
dbArg: SmartdataDb | (() => SmartdataDb)
): SmartdataCollection<any> => {
if (!this.collections[nameArg]) {
this.collections[nameArg] = (() => {
if (dbArg instanceof SmartdataDb) {
@ -18,5 +21,5 @@ export class CollectionFactory {
})();
}
return this.collections[nameArg];
}
}
};
}

View File

@ -43,7 +43,7 @@ export class SmartdataDb {
useNewUrlParser: true,
useUnifiedTopology: true,
maxPoolSize: 100,
maxIdleTimeMS: 10
maxIdleTimeMS: 10,
});
this.mongoDb = this.mongoDbClient.db(this.smartdataOptions.mongoDbName);
this.status = 'connected';