- You can now pass TypeScript generics to all service methods for precise type inference and enhanced type safety. This helps you catch mistakes at compile time and improves your development experience.
- Added
escapeRegExpoption to service methods, enabling automatic escaping of$regexfilter values to prevent special characters from being interpreted as patterns.
- Upgraded
mongodbdependency to v6.17.0 and updated related dependencies (mocha, @types/mocha, zod, etc.). - Fixed all known vulnerabilities.
- Upgraded
mongodbdependency from v4.10.0 to v6.1.0 (requires Node.js >=16.16.0). - Cleaned up legacy MongoDB connection options.
- Improved typings and compatibility for bulk operations and index management.
- Synchronized README.md with the documentation website for consistency and completeness.
- Fixed:
atomic.updateOneandatomic.updateManynow usereadConfigfor query validation, ensuring consistent handling of soft-delete and query options.
- Refactored
ServiceandDatabaseclasses for better type safety:IDocumentnow extends MongoDB’sDocumentand requires_id: string.- Many methods now use stricter generic constraints (
<T extends IDocument>).
- Added support for custom schema validation via
schemaValidatorinServiceOptions. - Introduced new config types:
CreateConfig,ReadConfig,UpdateConfig,DeleteConfigfor more granular operation control. - Improved transaction support:
database.withTransactionnow uses default transaction options and better error handling. - Enhanced logging for event publishing and warnings in development mode.
- Internal: Cleaned up and unified method signatures, improved property type checks, and removed legacy/duplicate code.
- Changed all date fields (
createdOn,updatedOn,deletedOn) to use nativeDateobjects instead of ISO strings.
service.find()optionspageandperPageare now optional; defaults are set internally if omitted.
eventBus.onUpdatednow supports generics for improved type safety.service.aggregate()now returns an array of results directly.
- In-memory event listeners now require an entity name (e.g.,
onUpdated('users', ...)). - Added logging for published in-memory events.
The release includes a lot of changes to make sure that the package is compatible with the latest MongoDB version.
Most notable changes:
- Rewritten in TypeScript
- Removed monk dependency.
- Added mongodb native Node.JS sdk as dependency.
- Added support for transactional events using transactional outbox pattern
- Introduced shared in-memory events bus. It should be used to listen for CUD updates.
- Update dependencies.
Breaking Changes
Manager
createQueryService- Rename
validateSchemaoption tovalidate. - Change
addCreatedOnFielddefault totrue. - Change
addUpdatedOnFielddefault totrue.
- Rename
validateSchemaoption tovalidate. - Change
addCreatedOnFielddefault totrue. - Change
addUpdatedOnFielddefault totrue.
Query Service
- Remove
generateIdmethod. - Remove
expectDocumentmethod.
Service
- Remove
updatemethod. Use updateOne or updateMany. - Remove
ensureIndex. Use atomic.createIndex. - Remove
createOrUpdate. Use create or updateOne or updateMany. - Remove
findOneAndUpdate. Use findOne and updateOne.
Features
Manager
createQueryService- Add
useStringIdoption.
- Add
useStringIdoption.
Query Service
- Add more monk’s methods. See full list
Service
- Add generateId method.
- Add updateOne method.
- Add updateMany method.
- Add performTransaction method.
- Add more monk’s methods in
atomicnamespace. See full list
- Update dependencies.
- Add tests.
- Fix required version of the Node.js.
Breaking Changes
- Now, by default, we do not add the fields
createdOnandupdatedOnautomatically to the model. If you want to save the current behavior, add the appropriateaddCreatedOnFieldandaddUpdatedOnFieldoptions to the service definitions.
- Stop using deprecated method
ensureIndexof themonk.
- Add ability to create custom methods for service and query service.
- Add tests.
