title: How do I account for Google Cloud Firestore security rules in Firebase Functions?
body: <p>If I create a Firebase Function, I am able to freely read and write to my Firestore database using:</p>
  
  <pre><code>const admin = require('firebase-admin');
  [...]
  admin.firestore().collection("collection").add({"foo": "bar"});
  </code></pre>
  
  <p>While I see that the <code>firebase-functions</code> library provides a reference to <code>firestore</code>, I can't see in the <a href="https://firebase.google.com/docs/reference/functions/providers_firestore_" rel="nofollow noreferrer">documentation</a> how this is used in a similar manner to add/update data with the constraints of security rules. </p>
  
  <p>Is this the the class I should be using, or are there other means to adopt this security from within a Function?</p>