Document Service API: Triggered database lifecycle hooks
Depending on the Document Service API methods called, the following database lifecycle hooks are triggered:
Document Service API method | Triggered database lifecycle hook(s) |
---|---|
findOne() | before(after) findOne |
findFirst() | before(after) findOne |
findMany() | before(after) findMany |
create() | before(after) Create |
create({ status: 'published' }) |
|
update() |
|
update({ status: 'published' }) |
|
delete() | before(after) Delete Can be triggered multiple times if deleting multiple locales (one per each locale) |
publish() |
|
unpublish() | before(after) Delete
|
discardDraft() |
|
count() | before(after) Count |
βοΈ Note
Bulk actions lifecycles (createMany
, updateMany
, deleteMany
) will never be triggered by a Document Service API method.