title: firestore security rule resource.data is empty object
body: <p>In firestore security rule, the resource.data is an emtpy object always, is this a bug or something ?</p>
  <p>My firestore rules:</p>
  <pre><code>service cloud.firestore {
    match /databases/{database}/documents {
      match /hospitals/{document=**}{
  
        // allow read :if resource.data.size() == 0; //this return true, resource.data is an empty object
  
            allow read :if resource.data.name != null; // this doesn't work
      }
    }
  }
  </code></pre>
  <p>My javascript:</p>
  <pre><code>auth().onAuthStateChanged((user) =&gt; { 
    if (user) {
  
      //db is the firestore instance
      db.collection('/hospitals').get()
        .then(printResult)
  
    } else {
      
    }
  }) 
  </code></pre>
  <p>this is my current database snapshot
  <a href="https://i.stack.imgur.com/7vlTX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7vlTX.png" alt="image " /></a></p>
  <h1>solved :</h1>
  <p>thanks for Frank's answer</p>
  <p>the issue rely on that firestore security doesn't evaluate the actual document value when we query a over multiple document , in my case</p>
  <pre><code>//this doesn't firestore doesnt' evaluate the documetn
  db.collection('hospitals').get()
  
  //this will work ,if you need to compare the actual value
  db.document('hospitals/somehospital').get()
  </code></pre>