Monguito v6.1.3 is a lightweight, type-safe MongoDB repository library for Node.js that implements the repository and polymorphic patterns on top of Mongoose (v8+). It reduces boilerplate by providing a generic MongooseRepository class with basic CRUD operations (findById, findOne, findAll, save, deleteById) and supports polymorphic schemas via subtype configuration. It ships with TypeScript types and requires Node.js >= 18.18.0. Unlike raw Mongoose or other ODM wrappers, Monguito enforces a structured repository pattern and optional audit data tracking.
npm install monguitoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates defining a MongooseEntity, creating a custom repository with a finder method, and using the Optional utility.
Upgrade Node.js to 18.18.0+ and Mongoose to 8.0.0+.
Update constructor to use options object: super({ type, schema, subtypes? }).Adjust callers to handle MongooseEntity instance instead of plain object.
Ensure the `subtypes` array is provided in super() options when using polymorphic schemas.
If you need custom queries, add a method inside the repository subclass.
Run `npm install monguito` and ensure Node.js version is 18.18.0 or higher.
Use `import { MongooseRepository } from 'monguito'` in an ESM module or use dynamic import.Use `import { Optional } from 'monguito'` (curly braces).Check that the data passed to save() matches schema requirements.