dontknowhy
dontknowhy

Reputation: 2866

Firebase Firestore, Delete Collection with a Callable Cloud Function

if you see here https://firebase.google.com/docs/firestore/solutions/delete-collections

you can see the below

Consistency - the code above deletes documents one at a time. If you query while there is an ongoing delete operation, your results may reflect a partially complete state where only some targeted documents are deleted. There is also no guarantee that the delete operations will succeed or fail uniformly, so be prepared to handle cases of partial deletion.

so how to handle this correctly?

this means "preventing users from accessing this collection while deletion is in progress?"

or "If the work is stopped by accessing the collection in the middle, is it to call the function again from the failed part to proceed with the complete deletion?"

Upvotes: 0

Views: 182

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317372

so how to handle this correctly?

It's suggesting that you should check for failures, and retry until there are no documents remaining (or at least until you are satisfied with the result).

Upvotes: 1

Related Questions