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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…