Compare commits

..

2 Commits

Author SHA1 Message Date
4733982d03 5.8.0
Some checks failed
Default (tags) / security (push) Successful in 32s
Default (tags) / test (push) Successful in 3m3s
Default (tags) / release (push) Failing after 52s
Default (tags) / metadata (push) Successful in 59s
2025-04-14 17:58:54 +00:00
368dc27607 feat(cursor): Add toArray method to SmartdataDbCursor to convert raw MongoDB documents into initialized class instances 2025-04-14 17:58:54 +00:00
4 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 2025-04-14 - 5.8.0 - feat(cursor)
Add toArray method to SmartdataDbCursor to convert raw MongoDB documents into initialized class instances
- Introduced asynchronous toArray method in SmartdataDbCursor which retrieves all documents from the MongoDB cursor
- Maps each native document to a SmartDataDbDoc instance using createInstanceFromMongoDbNativeDoc for consistent API usage
## 2025-04-14 - 5.7.0 - feat(SmartDataDbDoc)
Add extended cursor method getCursorExtended for flexible cursor modifications

View File

@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartdata",
"version": "5.7.0",
"version": "5.8.0",
"private": false,
"description": "An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.",
"main": "dist_ts/index.js",

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartdata',
version: '5.7.0',
version: '5.8.0',
description: 'An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.'
}

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