-
Notifications
You must be signed in to change notification settings - Fork 0
Overview
RezaNajafian edited this page Dec 8, 2025
·
1 revision
MongoHelper is a helper library built on top of the official MongoDB Java driver. It provides a simple, metadata-driven way to:
-
Describe your data model using an
OrmSchematic - Automatically create collections and indexes based on metadata
-
Access grouped CRUD operations through
OperationsGroup
Instead of working directly with MongoCollection everywhere, you:
- Define an
OrmSchematicthat lists your models, value types, and enums. - Register that schematic in a
MongoHelperinstance. - Retrieve an
OperationsGroupfor each model to perform operations.
This leads to cleaner code, a single place to configure your MongoDB schema, and reusable metadata for indexes and codecs.
-
MongoHelper: The main entry point. Created from aMongoClient. You use it to register schematics and getOperationsGroupinstances. -
OrmSchematic: Describes which database to use and which model/type/enum classes belong to that schema. Optionally customizes codec registries. -
SchematicRegistry(internal): Manages schematics, builds metadata, and creates collections and indexes. -
OperationsGroup<M>: Groups all operations for a given model classM(count, create, delete, find, update, upsert).
MongoHelper does not replace the MongoDB driver. It builds on top of it and manages metadata, codec registries, and per-model operations so that your application code can be simpler and more consistent.