title: Mongodb aggregation $unwind then count
body: <p>Here is my problem : in my Mongo database, I have a collection with items like :</p>
  
  <pre><code>{
    'id': 1,
    'steps': [
      {
        action: 'start',
        info: 'foo'
      },
      {
        action: 'stop',
        info: 'bar'
      }
    ]
  }
  </code></pre>
  
  <p>I would like to get the total number of steps 'start'.
  I tryed to use the MongoDB aggregation framework : I use <code>$unwind</code> on <code>steps.action</code> and <code>$match</code> on <code>steps.action</code> to match 'start'.</p>
  
  <p>However, I get too much data and reach the aggregation's limit :
  <code>exception: aggregation result exceeds maximum document size (16MB)</code>. I don't need the data, I just want the count, but I couldn't find how to do it (tryed with $group without success).</p>
  
  <p>Thanks in advance,</p>