Compare commits

..

2 Commits

Author SHA1 Message Date
938b25c925 5.7.0
Some checks failed
Default (tags) / security (push) Successful in 39s
Default (tags) / test (push) Successful in 3m2s
Default (tags) / release (push) Failing after 51s
Default (tags) / metadata (push) Successful in 59s
2025-04-14 17:49:07 +00:00
ab251858ba feat(SmartDataDbDoc): Add extended cursor method getCursorExtended for flexible cursor modifications 2025-04-14 17:49:07 +00:00
4 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## 2025-04-14 - 5.7.0 - feat(SmartDataDbDoc)
Add extended cursor method getCursorExtended for flexible cursor modifications
- Introduces getCursorExtended in classes.doc.ts to allow modifier functions for MongoDB cursors
- Wraps the modified cursor with SmartdataDbCursor for improved API consistency
- Enhances querying capabilities by enabling customized cursor transformations
## 2025-04-07 - 5.6.0 - feat(indexing)
Add support for regular index creation in documents and collections

View File

@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartdata",
"version": "5.6.0",
"version": "5.7.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.6.0',
version: '5.7.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

@ -249,6 +249,19 @@ export class SmartDataDbDoc<T extends TImplements, TImplements, TManager extends
return cursor;
}
public static async getCursorExtended<T>(
this: plugins.tsclass.typeFest.Class<T>,
filterArg: plugins.tsclass.typeFest.PartialDeep<T>,
modifierFunction = (cursorArg: plugins.mongodb.FindCursor<plugins.mongodb.WithId<plugins.mongodb.BSON.Document>>) => cursorArg,
) {
const collection: SmartdataCollection<T> = (this as any).collection;
let cursor: plugins.mongodb.FindCursor<any> = collection.mongoDbCollection.find(
convertFilterForMongoDb(filterArg),
);
cursor = modifierFunction(cursor);
return new SmartdataDbCursor<T>(cursor, this as any as typeof SmartDataDbDoc);
}
/**
* watch the collection
* @param this