title: Firestore Invalid Permissions: request.auth.uid in
body: <p>I am using Cloud Firestore and I can't seem to get the "IN" operator to work with the security rules. I have tried using array and map but neither work. Of course when I set it to  <code>allow read, write;</code> it works fine. What am I doing wrong?</p>
  
  <p>Rules:</p>
  
  <pre><code>service cloud.firestore {
    match /databases/{database}/documents {
      match /rooms/{roomId=**} { 
        allow read, write: if request.auth.uid in resource.data.users;
        allow read, write: if request.auth.uid in resource.data.users2;
        allow create: if request.auth != null;
      }
      match /user-rooms/{userId} { 
        allow read, write: if userId == request.auth.uid;
      }
      match /users/{userId} {
        allow read, write: if request.auth.uid == userId;
        allow get, create: if request.auth != null;
      }
    }
  }
  </code></pre>
  
  <p>Client:  </p>
  
  <pre><code>db.collection("rooms")
    .document(self.room.getRoomId())
    .collection("messages")
    .addSnapshotListener { .....
  
  //Room is: d6l946swspNSouANzVdZ
  //Username is: eX8gkxJNDREv
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/9QrGa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9QrGa.png" alt="enter image description here"></a></p>