title: How To Detect Array Entry Deletion Request In Firestore Rules
body: <p>I need to delete an entry in an array in one of my documents in firestore (that's a lot of &quot;in's&quot;)</p>
  <p>The only way to do that (according to <a href="https://stackoverflow.com/a/59745086/9462397">this</a>) is through an update request that sets the entry's value to some weird non-number value using <code>FieldValue.arrayRemove(val)</code> or <code>FieldValue.delete()</code>.</p>
  <p>How do I detect this &quot;hippity hoppity delete your property&quot; value in Firestore rules? Because currently I have it set that you can only write your own UID to that array, and I want it to also allow you to delete your own entry.</p>
  <p>My Dart code:</p>
  <pre><code>FirebaseFirestore.instance.collection(&quot;requests&quot;).doc(id).update({&quot;likes.&quot; + FirebaseAuth.instance.currentUser.uid: FieldValue.delete()});
  </code></pre>
  <p>My Firestore rules (<code>likes</code> is the array):</p>
  <pre><code>rules_version = '2';
  service cloud.firestore {
  match /databases/{database}/documents {
    match /requests/{requestID} {
      allow update: if (request.resource.data.likes.hasOnly([request.auth.uid])) &amp;&amp; (resource.data.likes.size() + 1 == request.resource.data.likeCount);
          }
      }
  }
  </code></pre>
  <p>My firestore:
  <a href="https://i.stack.imgur.com/ZpFqD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZpFqD.png" alt="Firestore Pic" /></a></p>