title: Calculating database size percentage used in MongoDB
body: <p>I'm currently running <code>db.stats</code> on a database and then I get back some information that includes <code>dataSize</code> and <code>storageSize</code>. </p>
  
  <p>Now I'd imagine that </p>
  
  <ul>
  <li><code>dataSize</code> is how much data is in the database </li>
  <li><code>storageSize</code> is how much data I could store before the database is full. </li>
  </ul>
  
  <p>BUT when I do a calculation like <code>(dataSize/totalSize) * 100</code> to find the percentage of space that's used in the db, I get a number that's almost always greater than 100%.</p>
  
  <p>How can I use <code>db.stats</code> to tell me how much of the database space I'm currently using? </p>
  
  <p>I'm using Mongo 3.6 atm.</p>