title: Firestore rules : User access to a collection that contain userId
body: <p>I have 2 collections in my Firestore</p>
  <p>users : uid, email
  periods : periodId, name, owner_id</p>
  <p>I need rules for users access only to it's 'users' collection and another that allow read and write to 'periods' collection only if ownerId uid is equal to authentified user id.</p>
  <p>I do that</p>
  <pre><code>rules_version = '2';
  service cloud.firestore {
  
    match /databases/{database}/documents {
      match /users/{userId} {
        allow read, write : if request.auth != null &amp;&amp; request.auth.uid == userId;
        allow create: if request.auth != null;
      }
      
      match /periods/{periodId} {
              allow read, write : if request.auth.uid == request.resource.data. owner_id;
          }
    }
  
  }
  </code></pre>
  <p>But it doesn't work.</p>
  <p>:(</p>