When writing event based cloud functions for firebase firestore it's common to update fields in the affected document, for example:
When a document of users collection is updated a function will trigger, let's say we want to determine the user info state and we have a completeInfo: boolean
property, the function will have to perform another update so that the trigger will fire again, if we don't use a flag like needsUpdate: boolean
to determine if excecuting the function we will have an infinite loop.
Is there any other way to approach this behavior? Or the situation is a consequence of how the database is designed? How could we avoid ending up in such scenario?
question from:https://stackoverflow.com/questions/65850224/how-to-make-firebase-functions-update-the-same-document-which-it-is-listning-for