Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 1.39 KB

mongo-entity-callbacks.adoc

File metadata and controls

43 lines (34 loc) · 1.39 KB

Store specific EntityCallbacks

Spring Data MongoDB uses the EntityCallback API for its auditing support and reacts on the following callbacks.

Table 1. Supported Entity Callbacks
Callback Method Description Order

Reactive/BeforeConvertCallback

onBeforeConvert(T entity, String collection)

Invoked before a domain object is converted to org.bson.Document.

Ordered.LOWEST_PRECEDENCE

Reactive/AfterConvertCallback

onAfterConvert(T entity, org.bson.Document target, String collection)

Invoked after a domain object is loaded.
Can modify the domain object after reading it from a org.bson.Document.

Ordered.LOWEST_PRECEDENCE

Reactive/AuditingEntityCallback

onBeforeConvert(Object entity, String collection)

Marks an auditable entity created or modified

100

Reactive/BeforeSaveCallback

onBeforeSave(T entity, org.bson.Document target, String collection)

Invoked before a domain object is saved.
Can modify the target, to be persisted, Document containing all mapped entity information.

Ordered.LOWEST_PRECEDENCE

Reactive/AfterSaveCallback

onAfterSave(T entity, org.bson.Document target, String collection)

Invoked before a domain object is saved.
Can modify the domain object, to be returned after save, Document containing all mapped entity information.

Ordered.LOWEST_PRECEDENCE