Suppose I have a schema with an embedded document called settings, which contains several values. I am trying to make mongoose the default inline document in null
For example, how do I default fields to null for basic types such as strings and dates in the past.
var userSchema = new Schema({ name: {type: String, required: true}, preferences: {type: preferences, default: null} }); var preferences: { preference1: String, preference2: String }
How do I default property properties in userSchema to zero when creating a new document?
source share