title: Mongoose can't save embedded documents
body: <p>I am trying to create a document in Mongo DB which has an embedded document within it. The model/schema for the document is as follows:</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  // Cupboard Collection Schema
   var ShelfSchema = new Schema({
   shelf_name: {
      type: String
   },
   shelf_desc: {
      type: String
   }
  });
  
  var CupboardSchema = new Schema({
   cupboard_name: {
    type: String,
    required: true,
    unique: true
   },
  cupboard_desc: {
   type: String,
   required: true
  },
  shelf: [ShelfSchema]
  },
  {
    timestamps: true
  });
  
  module.exports = mongoose.model('Cupboard', CupboardSchema);
  </code></pre>
  
  <p>Image shows the code for saving the document.
  <a href="https://i.stack.imgur.com/WbYLH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WbYLH.png" alt="Code for saving document"></a></p>
  
  <p>When i print the "newCupboard" in console, I am getting the document in exact format as follows:</p>
  
  <pre><code>{
  _id: 58e4b972931dc809f4127b0b
  cupboard_name: Cupboard A,
  cupboard_desc: Cupboard A Details,
  shelf: [ {
   shelf_name: Cupboard A,
   shelf_desc: Cupboard A Details,
   _id: 58e4c2742bfc0111dc47f149
   }]
  }
  </code></pre>
  
  <p>But after the execution, the embedded document is not getting saved &amp; no error is shown. Final result is as shown below:</p>
  
  <pre><code>{
   _id: 58e4b972931dc809f4127b0b
   cupboard_name: Cupboard A,
   cupboard_desc: Cupboard A Details
  }
  </code></pre>
  
  <p>Can anybody help me to figure this out, why the embedded doc is not getting saved in mongo db ?</p>
  
  <p>Thanks.</p>