title: Trying to populate an array in mongo shell
body: <p>Im trying to populate the array that I describe below results and the output give me the array with 4 null elements</p>
  
  <pre><code>  "result" : [
            {
                    "maxTemp" : 83,
                    "group_id" : "Florida"
            },
            {
                    "maxTemp" : 57,
                    "group_id" : "New Mexico"
            },
            {
                    "maxTemp" : 81,
                    "group_id" : "California"
            },
            {
                    "maxTemp" : 57,
                    "group_id" : "Vermont"
            }
    ],
    "ok" : 1
  </code></pre>
  
  <p>the code is </p>
  
  <pre><code>db.data.aggregate( 
             {
               $group: {
                   _id: "$State"
                 , maxTemp: { $max :"$Temperature"}
               }
             },
             { $project: {
                  _id: 0,
                  group_id:"$_id",
                  maxTemp: "$maxTemp"
              }}
          ).result.forEach(function(match) {
              results.push(db.data.findOne(match));
          });
  </code></pre>
  
  <p>but the output give this result</p>
  
  <pre><code>&gt; results
  [ null, null, null, null ]
  </code></pre>
  
  <p>what could I do to populate results?</p>