title: How to count Booleans in MongoDB with aggregation framework
body: <p>Documents are stored with the following fields:</p>
  
  <pre><code>_id:
  NumberofChildren: Integer
  OwnsAHome: Boolean
  Income: Integer
  </code></pre>
  
  <p>I need to use the aggregation framework to sort by number of children so the output is something like this:</p>
  
  <pre><code>Number of Children: 3
  Number of People: some value, say 17
  Number of People who own a home: some value less than 17 which is a sum of the number of true Booleans
  Average income: some value
  </code></pre>
  
  <p>How would I do this in <b> MongoDB with aggregation </b>, especially in regards to counting the number of times the <code>Boolean OwnsAHome</code>, is <code>true</code>?</p>
  
  <p>Thanks!</p>