I have a Firestore collection called "documents":
db
\documents
\$documentId
I have created a cloud function that fires each time a new document is added/deleted. This function increments/decrements a number in the real-time database at:
db
\documents
\$documentId: 10,000
My boss asked me to implement a delete account option that can delete all user documents.
What I have tried is to create another cloud function that fires when the user deletes the account in authentication. The problem arises when I delete all the documents in the collection, because for each document delete, the first function fires and decrements the number in the real-time database and I don't want the function to be invoked. How to avoid the first cloud function to decrement the number in real-time database, when I delete all documents in Firestore using cloud function?