title: Firebase Security Rules for a collection named "documents"
body: <p>I'm trying to put some security rules in my Firestore database.
  For all of my collections, it works like a charm.
  Except one: a collection named "documents".</p>
  
  <p>There is any known limitation about this?</p>
  
  <p>Thanks!</p>
  
  <pre><code>rules_version = '2';
  
  service cloud.firestore {
    match /databases/{database}/documents {
  
      // kind of custom validations...
  
      function isPartOfGroup1() {
        return request.auth.uid != null &amp;&amp; request.auth.token.group == 'group1';
      }
      function isPartOfGroup2() {
        return request.auth.uid != null &amp;&amp; request.auth.token.group == 'group2';
      }
  
      // those rules didn't work:
  
      match /documents/{documents}/{document=**} {
        allow get: if isPartOfGroup1();
        allow list: if isPartOfGroup1();
        allow create: if isPartOfGroup1();
        allow update: if isPartOfGroup1();
        allow delete: if isPartOfGroup1();
      }
  
      // for example, rules that works:
  
      match /poll/{poll}/{document=**} {
        allow get: if isPartOfGroup1() || isPartOfGroup2();
        allow list: if isPartOfGroup1() || isPartOfGroup2();
        allow create: if isPartOfGroup1();
        allow update: if isPartOfGroup1();
        allow delete: if isPartOfGroup1();
      }
  
      //...
  
    }
  }
  </code></pre>
  
  <p>The result in the web console:</p>
  
  <p>Uncaught (in promise) FirebaseError: Missing or insufficient permissions.</p>