Cascading delete

Am I correct we have to create an index and use Map with Paginate? Am I correct it will delete only the first page so 64 items by default? Thank you.

Hey Daniel,

I’m confused by the ‘cascading’ in the title of your question. From what you wrote it seems as if you are rather doing a bulk delete?

Maybe you are starting from one document that you want to delete and want to delete all links in one transaction? You are right that from the moment you do something like this which is a cascading delete, (I didn’t test the code, might have syntax errors)

Let({
   linked_entities: Paginate(Match(Index('other_entities_by_linked_ref'), <some reference>))
},
Do(
  Delete(< some reference>),
  Map(Var('linked_entities'), Lambda(['ref'], Delete(Var('ref')))
)

That in this case you will only delete the amount of linked entities that fit in one page.
You could bump your page size (as you know) by adding a parameter to Paginate but once you go beyond the max of 100000 elements in one page, you’ll have to follow the after cursor which is something you’ll have to check in your host language.

From the moment you use Paginate, you are acting on pages so if you would have linked elements that go beyond this page size you’ll definitely have to use after cursors to delete everything.