title: Mongoose not saving nested object
body: <p>I'm puzzled as of why Mongoose isn't saving my object:</p>
  
  <pre><code>var objectToSave = new ModelToSave({
    _id : req.params.id, 
    Item : customObject.Item //doesn't save with customObject.getItem() neither
  });
  </code></pre>
  
  <p>But is saving this; as is below or with hardcoded values:</p>
  
  <pre><code>var objectToSave = new ModelToSave({
    _id : req.params.id, 
    Item : {
      SubItem : {
        property1 : customObject.Item.SubItem.property1, //also saves with customObject.getItem().SubItem.getProperty1()
        property2 : customObject.Item.SubItem.property2
      }
    }
  });
  </code></pre>
  
  <p>The getters/setters are </p>
  
  <pre><code>MyClass.prototype.getItem = function(){ ... };
  </code></pre>
  
  <p>My Item object is quite big, and I'd rather not have to specify every single sub properties...</p>
  
  <p>When I view my Item object with console.log(customObject.Item) or when I return it through my API as JSON, it has all the nested properties (SubItem, ...) that I'm expecting.</p>
  
  <p>Item is defined as:</p>
  
  <pre><code>SubItem = require('SubItemClass.js');
  
  function MyClass(){
    this.Item = {
      SubItem : new SubItem()
    }
  }
  </code></pre>
  
  <p>And SubItem is defined as</p>
  
  <pre><code>function SubItem(){
    this.property1 = '';
    this.property2 = 0;
  }
  </code></pre>
  
  <p>The model seems to work as expected, because If I hardcode data or if I specify every single properties to save to the model, I can save the data to the Model...</p>
  
  <p>here's the code anyway:</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  var subItemDefinition = {
    Property1 : {type:String},
    Property2 : {type:Number},    
  };
  
  var itemDefinition = {
    SubItem : subItemDefinition
  };
  
  var customDefinition = {
    Item : itemDefinition
  };
  
  var customSchema = new Schema(customDefinition); 
  module.exports = mongoose.model('ModelToSave', customSchema);
  </code></pre>
  
  <p>Thanks for your help</p>