Important:
The before delete
operation hook does not receive a list of deleted model instance IDs, because backend data stores such as relational or NoSQL databases don’t provide this information. However, when deleting a single model instance hook receives ctx.where
that contains the id
of the instance being deleted.
If I understand correctly, the meaning of the annotation is this :
When the PersistedModel.destroyAll method called, ctx.where has no 'id' property.
When PersistedModel.prototype.destroy or PersistedModel.destroyById method called, there is ctx.where.id, and it's value is instance id.
But in some cases, the ctx.where.id works differently. In my cases, when the model is custom user model which inherited from User model, ctx.where.id is 'inq' filter, looks like this:
ctx : {
where : {
id: {
inq: [1,2,3]
}
}
}
Very weird situation. I think that some inner changes are not reflected in the document.