-
Notifications
You must be signed in to change notification settings - Fork 9
How it works
When RelMongo is enabled it will register a custom listener on database operations. Depending on whether the driver is loading or saving objects, RelMongo will process the relations.
When loading an object, RelMongo checks if a supported annotation is present on attributes and makes the associated query in the database to fill the child objects, note that RelMongo makes a query for every association even if the child attribute is of type Collection it loads all the objects in one shot.
RelMongo supports both EAGER and LAZY fetching.
-
On EAGER fetching, all the child association is fetched on loading.
-
On LAZY fetching, the child association is loaded only when it is used.
When saving an object, RelMongo checks if a supported annotation is present, it will only stores two fields of the child object:
- _id : the object MongoDB id
- _relmongo_target : the referenced collection
© Copyright Kais OMRI under the Apache License 2.0