title: update the mongodb embedded document with $elemMatch
body: <p>I have a model with array of embedded documents. </p>
  
  <pre><code>var CourseSchema = mongoose.Schema({
           invitations: [InvitationSchema],
           total:Number
  });
  
  var InvitationSchema = new mongoose.Schema({
      token: { type:String, required: true},
      email: String
  });
  </code></pre>
  
  <p>want to update/increase the total number of invitation by matching the token of invitation embedded array from the request, here I followed a tutorial in <a href="http://diogogmt.wordpress.com/2012/03/23/update-elementmatch-and-the-positional-operator-on-mongodbmongoose/" rel="nofollow">http://diogogmt.wordpress.com/2012/03/23/update-elementmatch-and-the-positional-operator-on-mongodbmongoose/</a></p>
  
  <p>so I tried </p>
  
  <pre><code>var options = { new: false , select:'_id'};
  CourseModel.update({'_id':id,'invitations':{'$elemMatch':{'token':token}}},{'$inc':{'total':1}},options,function(err,data) { 
      if(err){callback(err, null);}
      else{
          callback(null, data);
      }      
  })
  </code></pre>
  
  <p>But it doesn't work,  if I remove the 'invitations':{'$elemMatch':{'token':token}}, the query would work</p>