Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose validate on update

/*
To turn on update validators, set the runValidators option
for update() or findOneAndUpdate().
*/

Model.update({_id: id}, { field: newValue }, { runValidators: true }, function(err) {
  ....
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongoose #validate #update
ADD COMMENT
Topic
Name
4+2 =