[[mongo.entity-callbacks]]
= Store specific EntityCallbacks

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

.Supported Entity Callbacks
[%header,cols="4"]
|===
| 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`

|===

