title: mapReduce or aggregation for averages of nested properties
body: <p>My collection has documents like this:</p>
  
  <p>day</p>
  
  <p>--hour</p>
  
  <p>----minute</p>
  
  <p>...where each hour is a property on day, and each minute is a property on an hour:</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>///first hour, first minute ... last hour, last minute
  {
   0: {0:{x:1, y:2}...59:{x:3, y:8}}
   ...
   23: {0:{x:1, y:2}...59:{x:3, y:8}} 
  }
  </code></pre>
  
  <p>I want to average the values on the properties of the minutes to return a collection of documents like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>//first hour, average values ... last hour, average values
  
  {
  0:{x:2, y:5}
  ...
  23:{x:2, y:5}
  }
  </code></pre>
  
  <p>Can I use mapReduce or the aggregation pipeline to do this? How? </p>
  
  <p>One hitch: I also want to filter out preformatted minutes like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>59: {x:0, y:0} // zero means null record 
  </code></pre>