feat(cursor): Add toArray method to SmartdataDbCursor to convert raw MongoDB documents into initialized class instances

This commit is contained in:
2025-04-14 17:58:54 +00:00
parent 938b25c925
commit 368dc27607
3 changed files with 12 additions and 1 deletions

View File

@@ -40,6 +40,11 @@ export class SmartdataDbCursor<T = any> {
}
}
public async toArray() {
const result = await this.mongodbCursor.toArray();
return result.map((itemArg) => this.smartdataDbDoc.createInstanceFromMongoDbNativeDoc(itemArg));
}
public async close() {
await this.mongodbCursor.close();
}