title: Mongodb aggregation not working with mongoose
body: <p>I  have tested the following aggregation on mongodb shell and it works fine, but however it deoes not seem to work with mongoose. I have searched similar topics and issues  but their solutions don't solve mine.</p>
  
  <p>The document structure is this</p>
  
  <pre><code>{
    name,
    id,
  
    contacts:[{
      contactId, //I need an array of this field
      dateAdded
    }, {
      contactId,
      dateAdded
    },
    {}..]
  }
  </code></pre>
  
  <p>The mongooose schema is:  </p>
  
  <pre><code> var AccountSchema = new mongoose.Schema({
      email:     { type: String, unique: true },
      password:  { type: String },
      name: {
        first:   { type: String },
        last:    { type: String },
        full:    { type: String }
      },
      contacts:  [Contact]
    });
  </code></pre>
  
  <p>And here is the aggregation:</p>
  
  <pre><code> Account.aggregate({
     $match: { _id: accountId }
   }, {
     $unwind:"$contacts"
   },
   {
     $group: {
       _id: '$_id',
       list: { $push:'$contacts.accountId' }
     }
   }, {
     $project: {
       _id: 0,
       contacts: 1
     }
   }, function(err, doc) {
     // var l=doc.result[0].list;
     callback(doc);  
   });
  </code></pre>
  
  <p>On the Mongodb shell,the aggregation returns an array of contactID as shown below, but it returns an empty array on Mongoose</p>
  
  <pre><code>{
    "result" : [
      {
        "_id" : null,
        "list" : [
           ObjectId("xxxbnbnb2013-06-23T16:24:03.785Z"),
           ObjectId("mnmnmnmui2013-06-23T16:24:04.688Z")
        ]
      }
    ],
    "ok" : 1
  }
  </code></pre>