title: Reference documents with ObjectId when saving in mongoose
body: <p>I have the following schemas:</p>
  
  <pre><code>// ingredient
  var ingredSchema = new Schema({
    name: String,
    cost: Number
  });
  
  // order
  var orderSchema = new Schema({
    cusName: String,
    ingredients: [{type: Schema.Types.ObjectId, ref: 'Ingredient'}]
  });
  
  // create model
  var Ingredient = mongoose.model('Ingredient', ingredSchema);
  var Order = mongoose.model('Order', orderSchema);
  </code></pre>
  
  <p>I have already saved a bunch ingredients in a collection <code>ingredients</code> and have a UI where users choose a set of ingredients for their burgers. I then try to save an order for a burger in another collection <code>orders</code> within the same database <code>burgers</code> like this:</p>
  
  <pre><code>// get order info from the form
  var newOrder = new Order({ cusName: req.body.name, 
                             ingredients: req.body.ingredients });
  newOrder.save(function(err) {
      if (err)
          return console.log('Could not save your new order', err);
      res.redirect('/order');
  });
  </code></pre>
  
  <p>The call to save an order generates the following error:</p>
  
  <pre><code>{ message: Cast to ObjectId failed for value xxx at path 'ingredients',
    name: 'CastError',
    type: ObjectId,
    value: xxx,
    path: 'ingredients' }
  </code></pre>
  
  <p>I use mongoose version 3.6.11. Please help me hack this.</p>
  
  <p>PS: req.body.ingredients is an array built from checkboxes.</p>