title: How to default an embedded document to null with mongoose
body: <p>Lets say I have a schema with an embedded document called preferences that contains multiple values. I'm trying to have mongoose default the embedded document to null</p>
  
  <p>For example here's how I've defaulted fields to null for basic types like Strings and Dates in the past. </p>
  
  <pre><code>var userSchema = new Schema({
  name: {type: String, required: true},
  preferences: {type: preferences, default: null}
  });
  
  var preferences: {
  preference1: String,
  preference2: String
  }
  </code></pre>
  
  <p>How should I default the property preferences in the userSchema to be null on a new document's creation?</p>