title: How to get size in bytes of bson documents
body: <p>Is the int value returned by size() function of bson document the number of bytes ? (not able to find the details of this API).<br> How can I get the size of a bson document in bytes? Here is my code.</p>
  
  <pre><code>import org.bson.Document;
  
  MongoDatabase db...;
  MongoCollection&lt;Document&gt; mongoCollection = db.getCollection(...);
  MongoCursor&lt;Document&gt; cursor = mongoCollection.find().iterator();
  Document doc = cursor.next();
  int size = doc.size(); // does this return number of bytes 
  // how to get size of doc in bytes?
  </code></pre>