title: Inserting Array into Mongo using Mongoose not working
body: <p>I am trying to create a Mongo document but inserting into the array of the orderProducts element of the document is not working.</p>
  
  <p>This is the method to create order and insert into Mongo:</p>
  
  <pre><code>exports.createOrder = function(req, res) {
  
      var delivery = JSON.parse(req.body.delivery);
      var payment = JSON.parse(req.body.payment);
      var orderProducts = JSON.parse(req.body.orderItems);
  
      console.log('delivery', delivery)
      console.log('payment', payment)
      console.log('orderProducts', orderProducts);
  
      var newOrder = new Order({delivery, payment, orderProducts});
     // newOrder.orderProducts.push(orderProducts);
  
      console.log('new order', newOrder)
  
      res.json({'a':'b'})
  }
  </code></pre>
  
  <p>Upon parsing the data with this segment of code:</p>
  
  <pre><code>var delivery = JSON.parse(req.body.delivery);
  var payment = JSON.parse(req.body.payment);
  var orderProducts = JSON.parse(req.body.orderItems);
  </code></pre>
  
  <p>I get the expected results:</p>
  
  <pre><code>delivery:
   { firstName: 'fasdfasdf',
     lastName: 'dfasdas',
     email: 'asdfdfs@a',
     phone: 'addafdafd',
     shippingAddress: 'fasdfasdf',
     cityState: 'Brighton, MA',
     deliveryDate: 2018-04-06T00:00:00.000Z }
  
   payment:
    { paymentType: 'PayPal',
      cardNumber: 'fdasasdfdfaf',
      creditCardMonth: '11 - November',
      creditCardYear: '2028',
      cws: 'afd' },
  
  orderProducts [ { productId: '596161e1734d1d25634366ce', quantity: 1 },
    { productId: '596269eb734d1d256343976a', quantity: 1 },
    { productId: '5962a556734d1d256343a210', quantity: 1 } ]
  </code></pre>
  
  <p>But when I create the Mongo document using this segment of code:</p>
  
  <pre><code>var newOrder = new Order({delivery, payment, orderProducts});
  </code></pre>
  
  <p>The delivery and payment elements of newOrder are correct as shown above but for orderProducts, the data is missing. I only get the following:</p>
  
  <pre><code>orderProducts:
   [ { _id: 5ae5cb11dba7821f1840475f },
     { _id: 5ae5cb11dba7821f1840475e },
     { _id: 5ae5cb11dba7821f1840475d } ]
  </code></pre>
  
  <p>This is the Mongoose model for order:</p>
  
  <pre><code>var mongoose = require("mongoose");
  var Schema = mongoose.Schema;
  
  var DeliverySchema = new Schema({
      firstName: String,
      lastName: String,
      email: String,
      phone: String,
      shippingAddress: String,
      cityState: String,
      zip: String,
      deliveryDate: Date,
      deliveryInstruction: String,
      useAsBillinAddress: Boolean
  }, {_id: false});
  mongoose.model('Delivery', DeliverySchema);
  
  var PaymentSchema = new Schema({
      cardNumber: String,
      creditCardYear: String,
      creditCardMonth: String,
      cws: String,
      paymentType: String
  }, {_id: false})
  mongoose.model('Payment', PaymentSchema);
  
  var OrderProductSchema = new Schema({
      id: String,
      qty: Number
  }, {_id: false});
  mongoose.model('OrderProduct', OrderProductSchema);
  
  var OrderSchema = new Schema({
      delivery: DeliverySchema,
      payment: PaymentSchema,
      orderProducts: [{OrderProductSchema}],
      timestamp: {type: Date, default: Date.now}    
  });
  
  var Order = mongoose.model("Order", OrderSchema, "order");
  module.exports = Order;
  </code></pre>
  
  <p>How do I insert an array into a document?</p>