mongoose nullable
snippet in javascript

mongoose nullable

user8841

var userSchema = new mongoose.Schema({
  name: {type: String, required: true},
  preferences: {type : { preference1 : String, preference2 : String}, default : null}
});