title: pushing object into array schema in Mongoose
body: <p>I have this mongoose schema</p>
  
  <pre><code>var mongoose = require('mongoose');
  
  var ContactSchema = module.exports = new mongoose.Schema({
    name: {
      type: String,
      required: true
    },
    phone: {
      type: Number,
      required: true,
      index: {unique: true}
    },
    messages: [
    {
      title: {type: String, required: true},
      msg: {type: String, required: true}
    }]
  }, {
      collection: 'contacts',
      safe: true
  });
  </code></pre>
  
  <p>and trying to update the model by doing this:</p>
  
  <pre><code>Contact.findById(id, function(err, info) {
      if (err) return res.send("contact create error: " + err);
  
      // add the message to the contacts messages
      Contact.update({_id: info._id}, {$push: {"messages": {title: title, msg: msg}}}, function(err, numAffected, rawResponse) {
        if (err) return res.send("contact addMsg error: " + err);
        console.log('The number of updated documents was %d', numAffected);
        console.log('The raw response from Mongo was ', rawResponse);
  
      });
    });
  </code></pre>
  
  <p>I'm I not declaring the <code>messages</code> to take an array of objects?<br>
  <strong>ERROR:</strong> MongoError: Cannot apply $push/$pushAll modifier to non-array</p>
  
  <p>Any ideas?  </p>