fix(core): update

This commit is contained in:
2019-01-07 02:41:38 +01:00
parent ae7d101ab9
commit 692a1223a8
10 changed files with 325 additions and 49 deletions

View File

@ -56,7 +56,7 @@ export class SmartdataCollection<T> {
await this.smartdataDb.mongoDb.createCollection(this.collectionName);
}
this.mongoDbCollection = await this.smartdataDb.mongoDb.collection(this.collectionName);
console.log(`Successfully initiated Collection ${this.collectionName}`)
console.log(`Successfully initiated Collection ${this.collectionName}`);
}
}
@ -64,8 +64,8 @@ export class SmartdataCollection<T> {
* mark unique index
*/
markUniqueIndexes(keyArrayArg: string[] = []) {
for(let key of keyArrayArg) {
if(!this.uniqueIndexes.includes(key)) {
for (let key of keyArrayArg) {
if (!this.uniqueIndexes.includes(key)) {
this.mongoDbCollection.createIndex(key, {
unique: true
});

View File

@ -70,9 +70,10 @@ export class SmartdataDb {
async close(): Promise<any> {
await this.mongoDbClient.close();
this.status = 'disconnected';
plugins.smartlog
.defaultLogger
.log('info', `disconnected from database ${this.smartdataOptions.mongoDbName}`);
plugins.smartlog.defaultLogger.log(
'info',
`disconnected from database ${this.smartdataOptions.mongoDbName}`
);
}
// handle table to class distribution

View File

@ -39,7 +39,7 @@ export function unI() {
}
target.saveableProperties.push(key);
};
}
}
export class SmartDataDbDoc<T> {
/**