Pull/unset links to document upon deletion #1223
hadware
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
First of all, thanks for Beanie. This lib is absolutely fantastic and made me love MongoDB again :).
I'm an old-time user of mongoengine, and it had that one neat feature for
ReferenceField
s : the PULL/NULLIFY "reverse delete rule": https://docs.mongoengine.org/apireference.html#mongoengine.fields.ReferenceFieldThis would help you make sure that no links to other documents were left "dangling" when deleting a document, and prevented you the hassle of having to do post/pre-delete cleanup of references to a document.
From what I gathered, everything is already set up in Beanie for this feature to work. I could try and come up with a PR if you think you'd merge this.
I don't have a very definite idea of how the API would work, but the simplest way would be to add another
DeleteRules
-style parameter such as:Side note: the documentation is a bit unclear on how the current
DeleteRules
work. At first i thought this was the intented behavior, and i'm not the only one. IMHO this would benefit a bit more elaboration. I can also make a small PR on the doc if you tell me how you'd like it explained.Beta Was this translation helpful? Give feedback.
All reactions