Workflow Lifecycle
List
List
operation executes hook methods in the following sequence:
Hook |
Parameters |
Description |
docPermissions |
- Mongoose document
- global permissions
|
called after Mongoose execute the query; it runs on each document. |
decorate |
- plain document object
- global permissions
- context object:
docPermissions
|
runs on each document object. |
decorateAll |
- plain document objects
- global permissions
|
runs on set of document objects. |
Read
Read
operation executes hook methods in the following sequence:
Hook |
Parameters |
Description |
docPermissions |
- Mongoose document
- global permissions
|
called after Mongoose execute the query. |
decorate |
- plain document object
- global permissions
- context object:
docPermissions
|
|
Update
Update
operation executes hook methods in the following sequence:
Hook |
Parameters |
Description |
docPermissions |
- Mongoose document
- global permissions
|
called after Mongoose execute the query. |
validate |
- allowed object
- global permissions
- context object:
originalDoc , originalData , currentDoc
|
|
prepare |
- allowed object
- global permissions
- context object:
originalDoc , originalData , currentDoc
|
|
transform |
- allowed object
- global permissions
- context object:
originalDoc , originalData , currentDoc , preparedData , modifiedPaths
|
called before changes saved. |
docPermissions |
- Mongoose document
- global permissions
- context object:
originalDoc , originalData , currentDoc , preparedData , modifiedPaths
|
called after changes saved. |
decorate |
- plain document object
- global permissions
- context object:
originalDoc , originalData , currentDoc , preparedData , modifiedPaths , `docPermissions
|
|
Create
Create
operation executes hook methods in the following sequence:
Hook |
Parameters |
Description |
validate |
- allowed object
- global permissions
- context object:
originalData
|
|
prepare |
- allowed object
- global permissions
- context object:
originalData
|
|
docPermissions |
- Mongoose document
- global permissions
- context object:
originalData , preparedData
|
called after a document created. |
decorate |
- plain document object
- global permissions
- context object:
originalData , preparedData
|
|