title: MongoDB Average returning NULL
body: <p>I'm using MongoDB to get the average value of a car's engine size. However, the aggregate Average function keeps returning NULL.</p>
  
  <p>Part of the DB is as follows:</p>
  
  <pre><code> { "_id" : 1, "car" : { "engineSize" : 1.5 }, "addresses" : [ "X", "A" ] } 
  
   { "_id" : 6, "car" : { "engineSize" : 1.5 }, "addresses" : [ "X" ] }
  
   { "_id" : 2, "car" : { "engineSize" : 1.3 } }
  
   { "_id" : 5, "car" : { "engineSize" : 1.4 } } 
  
   { "_id" : 3, "car" : { "engineSize" : 1 } }
  </code></pre>
  
  <p>The command I am using to check for the average is:</p>
  
  <pre><code>db.project.aggregate([{$group : {_id: null, Average: {$avg: "$engineSize"}}}])
  </code></pre>
  
  <p>However, when I run this, it returns:</p>
  
  <pre><code> { "_id" : null, "Average" : null }
  </code></pre>
  
  <p>Any suggestions on how to get it to return the correct value (i.e. 1.24)?</p>