title: Firestore where clause with security rules
body: <p>Suppose there are the following rules in place </p>
  
  <pre><code>service cloud.firestore {
      match /databases/{database}/documents {
          function roomAccess() {
              return resource.data.allow_anonymous == true || (request.auth.uid == resource.data.uid);
          }
          function writeOnlyOwner() {
              return request.auth.uid == resource.data.uid;
          }
          match /rooms/{room_id} {
            allow read: if roomAccess();
            allow write: if writeOnlyOwner();
            allow create: if request.auth.uid != null;
          }   
      }
  }
  </code></pre>
  
  <p>Also, this is what an document in the collection <code>rooms</code> looks like
  <a href="https://i.stack.imgur.com/MGPCI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MGPCI.png" alt="Json format"></a></p>
  
  <p><strong>Question</strong> 
  Is there any way to query the specific room where the <code>access_key</code> is set to some value?</p>
  
  <pre><code> db.collection('rooms')
              .where('access_key', '==', access_key)
              .get()
  </code></pre>
  
  <p>It is important to note that i'm querying as the <code>creator</code> of the room (and the <code>room.uid</code> with match my <code>uid</code></p>
  
  <p>Nonetheless, it fails on access rights.
  And the documentation doesn't seem to describe such behavior.</p>
  
  <p>As far as I understood, the query fails because there might be <code>some</code> rooms, with this <code>access_key</code>, for which <code>roomAccess()</code> would fail. 
  But I can't seem to find a way around it.</p>