I\'m calling user.save() on an object, where I set user.signup_date = null;
user.first_name = null;
user.signup_date = null;
user.save();
On Mongoose documentation (Schema Types), you can go to the Arrays explanation. There, it says this:
Arrays are special because they implicitly have a default value of
[](empty array).
var ToyBox = mongoose.model('ToyBox', ToyBoxSchema);
console.log((new ToyBox()).toys); // []
To overwrite this default, you need to set the
defaultvalue toundefined
(I've made an addition inside the toys element)
var ToyBoxSchema = new Schema({
toys: {
type: [{
name: String,
features: [String]
}],
default: undefined
}
});