Schema:
var SomeSchema = new Schema({
name: { type: String, required: true, unique: true },
description: { type: String, required: false }
},{
versionKey: false
}
);
// In this case the client did not pass me a description, which is ok cause this property is not required. // Why would the update fail?
var update = {name: someName, description: someDescription};
findByIdAndUpdate(id, update, function(err, something) { ...
Here is the error, yup cannot cast null/undefined to a String but why try?
CastError: Cast to string failed for value "undefined" at path "description"