Skip to content

Cascade delete #655

Answered by jmikrut
wojciechkrol asked this question in Q&A
Jun 14, 2022 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

Hey @wojciechkrol — yes, this is possible! You'll need to write some hooks to do it. You could write a hook that can be used to traverse your collection schema and find any relationship fields, and for each one, you'd read the value of the relationship field and then delete all related documents using Payload's local API.

Know what I mean?

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@jmikrut
Comment options

Answer selected by wojciechkrol
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@DanRibbens
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants