title: Get the size of all the documents in a query
body: <p>Is there a way to get the size of all the documents that meets a certain query in the MongoDB shell?</p>
  <p>I'm creating a tool that will use <code>mongodump</code> (see <a href="https://docs.mongodb.org/manual/reference/program/mongodump/" rel="nofollow noreferrer">here</a>) with the <code>query</code> option to dump specific data on an external media device. However, I would like to see if all the documents will fit in the external media device before starting the dump. That's why I would like to get the size of all the documents that meet the query.</p>
  <p>I am aware of the <code>Object.bsonsize</code> method described <a href="https://docs.mongodb.org/manual/reference/mongo-shell/#miscellaneous" rel="nofollow noreferrer">here</a>, but it seems that it only returns the size of one document.</p>