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