Delete document and all "nested" documents (different collections)

I have 2 collections (not collection + subcollection):
- entries
- sub-entries
Relationships: 1 to Many.

If the user deletes an entry then all sub-entries should be deleted too.

I guess such logic:
1) Backend Call - Firebase - Delete Document
2) Loop Actions
3) For each item Delete Document where entry_id = this entry.

Am I right?
How to define documents which should be deleted?
Is loop actions necessary or is there any way to do it?
Please give me a short algorithm.

6 replies