title: truthiness in firestore security rules
body: <p>In the following example <code>updatedData.maxChips</code> is set to the number 50000 and <code>updatedData.maxScore</code> should not be defined.</p>
  <pre><code>function updatePlayerConditions(player) {
      let updatedData = request.resource.data;
      let originalData = resource.data;
      let condition1 = updatedData.maxChips &gt; 0 ? updatedData.maxChips == originalData.maxChips : true; // worked
      let condition2 = updatedData.maxScore ? updatedData.maxScore = originalData.maxScore : true;
      return condition1 &amp;&amp; condition2;
  
  }
  </code></pre>
  <p>The above code for condition1 works, but when I change <code>updatedData.maxChips &gt; 0</code> to just <code>updatedData.maxChips</code> or <code>!!updated.data.maxChips</code> it doesn't work. If JS truthiness rules applied to firestore security rules than this doesn't make sense to me.</p>
  <p>And I get the error FirebaseError: PERMISSION_DENIED: from condition2.</p>
  <p>How can I use an undefined value in security rules? It would be especially helpful if someone could explain or point to how firebase firestore security rules work generally. I've already looked here: <a href="https://firebase.google.com/docs/rules/rules-language#building_conditions" rel="nofollow noreferrer">https://firebase.google.com/docs/rules/rules-language#building_conditions</a></p>
  <p>Update: I realized I could replace <code>updatedData.maxScore</code> at the start of the ternary with <code>maxScore in updatedData</code> thanks to finding this question: <a href="https://stackoverflow.com/questions/51940235/firestore-security-rules-request-time-undefined-on-object">Firestore Security Rules: request.time &quot;undefined on object&quot;</a>. I'd still be happy to find or read an explanation on how truthiness in firestore security rules works.</p>