title: How to, using mongodb's aggregation or map/reduce, calculate fraction of users that have records every day, week and month
body: <p>Each MongoDB document looks like this (with properties that are irrelevant to this question being removed):</p>
  
  <pre><code>{
      "user_id" : 12345,
      "created" : ISODate("2013-06-17T20:10:10.741Z")
  }
  </code></pre>
  
  <p>Trying to figure out how to, with aggregation queries or map/reduce, calculate fraction of users that have records every day, week and month.</p>