title: mongodb $aggregate empty array and multiple documents
body: <p>mongodb has below document:</p>
  
  <pre><code>&gt; db.test.find({name:{$in:["abc","abc2"]}})
  { "_id" : 1, "name" : "abc", "scores" : [ ] }
  { "_id" : 2, "name" : "abc2", "scores" : [ 10, 20 ] }
  </code></pre>
  
  <p>I want get <strong>scores</strong> array length for each document, how should I do?</p>
  
  <p>Tried below command:</p>
  
  <pre><code>db.test.aggregate({$match:{name:"abc2"}}, {$unwind: "$scores"}, {$group: {_id:null, count:{$sum:1}}} )
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>{ "_id" : null, "count" : 2 }
  </code></pre>
  
  <p>But below command:</p>
  
  <pre><code>db.test.aggregate({$match:{name:"abc"}}, {$unwind: "$scores"}, {$group: {_id:null, count:{$sum:1}}} )
  </code></pre>
  
  <p>Return Nothing. Question:</p>
  
  <ol>
  <li>How should I get each lenght of scores in 2 or more document in one
  command? </li>
  <li>Why the result of second command return nothing? and how
  should I check if the array is empty?</li>
  </ol>