Created
March 27, 2015 18:43
-
-
Save danared/be8b2b5f8613b5a17dac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var updates = { $unset: { steak: true }, $set: { eggs: 0 } }; | |
// Note the `runValidators` option | |
Breakfast.update({}, updates, { runValidators: true }, function(err) { | |
console.log(err.errors['steak'].message); | |
console.log(err.errors['eggs'].message); | |
/* | |
* The above error messages output: | |
* "Path `steak` is required." | |
* "Path `eggs` (0) is less than minimum allowed value (2)." | |
*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment