title: How to get a Firestore document size?
body: <p>From <a href="https://firebase.google.com/docs/firestore/quotas" rel="noreferrer">Firestore docs</a>, we get that the <strong>maximum size for a Firestore document</strong> is:</p>
  
  <blockquote>
    <p>Maximum size for a document <strong>1 MiB</strong> (1,048,576 bytes)</p>
  </blockquote>
  
  <p><strong>QUESTION</strong></p>
  
  <p>How can I know the current size of a single doc, to check if I'm approaching 
  that 1mb limit?</p>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>var docRef = db.collection("cities").doc("SF");
  
  docRef.get().then(function(doc) {
      if (doc.exists) {
          console.log("Document data:", doc.data());
          // IS THERE A PROPERTY THAT CAN DISPLAY THE DOCUMENT FILE SIZE?
      } else {
          // doc.data() will be undefined in this case
          console.log("No such document!");
      }
  }).catch(function(error) {
      console.log("Error getting document:", error);
  });
  </code></pre>