How to delete objects based on nested objects' fields

Based on reading the docs, I don’t think something like this is possible with Dgraph GraphQL, but I wanted to confirm.

I know you can delete objects based on primitive fields with the @search directive. But let’s say I have a comment type and a discussion type, and I want all the comments to be deleted when the discussion is deleted.

Right now in my project, I am first doing a query to get all the comments in the discussion that needs to be deleted. Then I delete all the comments. Then I delete the discussion. Is this a good practice or can some of those steps be combined?

Not available at this time. I have requested a similar feature and was informed that it is only possible right now either the way you are doing it, or with a DQL mutation. How to delete with cascade? - #3 by pawan

1 Like

Ah ok, thank you.