title: Error in referencing custom schemas in node.js app
body: <p>Node.js newbie here...
  I have a two schemas and I am referencing one within the other. </p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  
  /*Model for user settings */
  
  var SettingsSchema = new Schema({
  shoppingDay: {type: String, default : "Friday"},
  shoppingFrequency : {type: String, default : "weekly"},
  reminderEmails : {type: Boolean, default : true}
  });
  
  module.exports = mongoose.model('Settings', SettingsSchema);
  </code></pre>
  
  <p>and </p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;    
  var Settings = require('./Settings.js');
  var SettingsSchema = Settings.Schema;   
  
  /*Model for user settings */
  var UserTrendSchema = new Schema({
      email : String,    
      settings  : SettingsSchema
  },
  {collection : 'UserTrends'});
  
  module.exports = mongoose.model('UserTrend', UserTrendSchema);
  </code></pre>
  
  <p>I am running into this error </p>
  
  <pre><code>throw new TypeError('Invalid value for schema path `'+ prefix + i +'`');
  </code></pre>
  
  <p>but if I make it an array, it works. </p>
  
  <pre><code>settings  : [SettingsSchema]
  </code></pre>
  
  <p>I don't want it to be an array. Just a single instance of settings. All the examples I see use their custom types as arrays. </p>
  
  <p>I also tried </p>
  
  <pre><code>settings  : {type: Schema.Types.ObjectId, ref: 'Settings'}
  </code></pre>
  
  <p>but it just creates an entry in the DB with an object id and does not include the default values</p>
  
  <pre><code> "settings": {
      "$oid": "54ccfdcb5926074c1d53d02f"
  },
  </code></pre>
  
  <p>What's the best way to do this?</p>