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();
But when I look at the user in the mongodb it still has the signup_date and first_name set…how do I effectively set this field as empty or null?
To remove those properties from your existing doc, set them to
undefinedinstead ofnullbefore saving the doc:Confirmed as still working in Mongoose 5.9.7. Note that the field you’re trying to remove must still be defined in your schema for this to work.