fix(core): update

This commit is contained in:
2023-02-06 11:43:11 +01:00
parent ef97b390d4
commit fd590e0be3
11 changed files with 1011 additions and 653 deletions

View File

@ -255,6 +255,16 @@ export class SmartDataDbDoc<T extends TImplements, TImplements, TManager extends
}
}
/**
* updates an object from db
*/
public async updateFromDb() {
const mongoDbNativeDoc = await this.collection.findOne(this.createIdentifiableObject());
for (const key of Object.keys(mongoDbNativeDoc)) {
this[key] = mongoDbNativeDoc[key];
}
}
/**
* creates a saveable object so the instance can be persisted as json in the database
*/