title: How can I check if an id exists in a document?
body: <p>I have a basic chat app and users can block each other. When <strong>user A</strong> blocks <strong>user B</strong>, <strong>user B</strong> is no longer available to send messages.</p>
  
  <h3>Blocks structure</h3>
  
  <p><a href="https://i.stack.imgur.com/gIZf0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gIZf0.png" alt="user-blocks collection"></a></p>
  
  <h3>Security rule (conversations)</h3>
  
  <pre><code>function isBlocked() {
    return !get(/databases/$(database)/documents/user-blocks/$(request.resource.data.receiverId)).data.hasAny([request.auth.uid]);
  }
  </code></pre>
  
  <p>So, when <strong>user B</strong> (authenticated user)
  sends a message to <strong>user A</strong> (receiver), it shouldn't be allowed to. Because <strong>user A</strong> has blocked <strong>user B</strong>.</p>
  
  <h3>Problem</h3>
  
  <p>The code above is not working. How can I check if <strong>user B</strong> id's does exists in a document?</p>