Documentation: confusing definition of refered deletion
Here there is the definition and usage of the reverse_delete_rule kwarg usable with reference fields, but it contradicts itself.
The paragraph immediately under the example says:
The declaration in this example means that when an Employee object is removed, the ProfilePage that belongs to that employee is removed as well. If a whole batch of employees is removed, all profile pages that are linked are removed as well.
So the relationship is:
Employee -> ProfilePage
And by deleting the parent (Employee) you can auto-trigger deletion of the children (ProfilePage(s)).
But then the definitions of the individual options describe the opposite, specifically the option used in the example above it:
mongoengine.NULLIFY
Any object’s fields still referring to the object being deleted are removed (using MongoDB’s “unset” operation), effectively nullifying the relationship.
According to this when the child object (ProfilePage) is deleted, the parent object (Employee) gets modified to remove the reference to the now gone child object.
So which is it?
Closing this, I slightly improved the doc. Basically CASCADE deletes a whole object whereas NULLIFY sets references to None