title: Mongodb aggrgation function for sum of embedded documents not working
body: <p>i get an error like</p>
  
  <pre><code>Array
  (
      [errmsg] =&gt; exception: the $unwind field path must be specified as a string
      [code] =&gt; 15981
      [ok] =&gt; 0
  )
  </code></pre>
  
  <p>While i used following query for given embedded document (I want to sum of rate_number from my given record of table structure)</p>
  
  <pre><code>global $DB, $mongo;
  $theObjId = new MongoId($post_id);
  $collection = $mongo-&gt;getCollection('mongo_hw_posts');
  
  $rt_sum = $collection-&gt;aggregate(
      array('$unwind'=&gt;$rate),
      array('$group'=&gt;
          array(
              '_id' =&gt; $theObjId
          ),
          array(
              'rate_number'=&gt;array('$sum' =&gt;$rate.'rate_number')
          ))
  );
  </code></pre>
  
  <p><strong>table structure</strong></p>
  
  <pre><code> {
     "_id": ObjectId("51ff3b38636e3b9803000001"),
     "class_id": NumberInt(2986),
     "created_by": NumberInt(1758),
     "created_datetime": NumberInt(1375681336),
     "deleted": NumberInt(0),
     "learn": {
       "0": {
         "user_id": NumberInt(0),
         "learn_date": NumberInt(0)
      }
    },
     "parent_id": "0",
     "post_text": "2%20C",
     "post_type": "text_comment",
     "rate": {
       "0": {
         "user_id": NumberInt(0),
         "rate_date": NumberInt(0),
         "rate_number": NumberInt(0)
      },
       "1": {
         "user_id": NumberInt(1457),
         "rate_date": NumberInt(1375764137),
         "rate_number": NumberInt(3)
      },
       "2": {
         "user_id": NumberInt(1619),
         "rate_date": NumberInt(1375764694),
         "rate_number": NumberInt(8)
      }
    },
     "serialized_data": "",
     "unique_key": "8bdddfe8137d14702b4517f7e8e88ee3",
     "user_role": "student"
  }   
  </code></pre>