diff --git a/changelog.md b/changelog.md index 23f8396..12ecf8e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-04-14 - 5.8.2 - fix(classes.doc.ts) +Ensure collection initialization before creating a cursor in getCursorExtended + +- Added 'await collection.init()' to guarantee that the MongoDB collection is initialized before using the cursor +- Prevents potential runtime errors when accessing collection.mongoDbCollection + ## 2025-04-14 - 5.8.1 - fix(cursor, doc) Add explicit return types and casts to SmartdataDbCursor methods and update getCursorExtended signature in SmartDataDbDoc. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 238d6dd..132eab2 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartdata', - version: '5.8.1', + version: '5.8.2', description: 'An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.' } diff --git a/ts/classes.doc.ts b/ts/classes.doc.ts index 530b006..b1be379 100644 --- a/ts/classes.doc.ts +++ b/ts/classes.doc.ts @@ -255,6 +255,7 @@ export class SmartDataDbDoc>) => cursorArg, ): Promise> { const collection: SmartdataCollection = (this as any).collection; + await collection.init(); let cursor: plugins.mongodb.FindCursor = collection.mongoDbCollection.find( convertFilterForMongoDb(filterArg), );