title: How to avoid loops when writing cloud functions?
body: <p>When writing event based cloud functions for firebase firestore it's common to update fields in the affected document, for example:</p>
  
  <p>When a document of <em>users collection</em> is updated a function will trigger, let's say we want to determine the user info state and we have a <code>completeInfo: boolean</code> property, the function will have to perform another update so that the trigger will fire again, if we don't use a flag like <code>needsUpdate: boolean</code> to determine if excecuting the function we will have an infinite loop.</p>
  
  <p>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?</p>