title: Firebase Security Rules - Undefined Resource Error
body: <p>I have collection <strong>Users</strong> which has documents with the same Id as the user.uid. I want to allow logged in users to create documents and only update, delete and read their documents which is specified with the same UID as mentioned.</p>
  <p>I tried this but it keeps failing.</p>
  <pre><code>rules_version = '2';
  service cloud.firestore {
  match /databases/{database}/documents {
  match /users/{document} {
  allow create, : if request.auth != null;
     allow update, delete, read: if request.auth != null &amp;&amp; request.auth.uid == request.resource.data.UID;
    }
   }
  }
  </code></pre>
  <p>In this code i am trying to compare the uid of the logged user with a document field called UID</p>