title: How to filter fields in documents with security rules
body: <p>I am experimenting with Cloud Firestore security rules. Is it possible to filter document fields? </p>
  
  <p>For example if you have a document </p>
  
  <pre><code>{
    name: "John Doe",
    email: "doe@example.com"
  }
  </code></pre>
  
  <p>then some users aren't allowed to get the document with the email address. Their application requests the document with</p>
  
  <pre><code>firebase.firestore.doc('users/doe-uid')
  </code></pre>
  
  <p>and gets this document</p>
  
  <pre><code>{
    name: "John Doe",
  }
  </code></pre>
  
  <p>If yes, how?</p>
  
  <p>I think it should be possible because the <a href="https://firebase.google.com/docs/firestore/reference/security" rel="nofollow noreferrer">Cloud Firestore Security Rules Reference</a> says in the first sentence (emphasis is mine):</p>
  
  <blockquote>
    <p>Cloud Firestore Security Rules are used to determine who has read and write access to collections and documents stored in Cloud Firestore, as well as how documents are structured and <strong>what fields and values they contain</strong>. </p>
  </blockquote>
  
  <p>However I couldn't find anything in the reference telling me how to filter out fields.</p>