Created
February 4, 2018 18:22
-
-
Save jvitoroc/d90b4f2c33548c29c700a22a5bcc24f6 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 schema = new Schema({ | |
name: { | |
type: String, | |
required: true | |
} | |
}); | |
var Cat = db.model('Cat', schema); | |
// This cat has no name :( | |
var cat = new Cat(); | |
cat.save(function(error) { | |
assert.equal(error.errors['name'].message, | |
'Path `name` is required.'); | |
error = cat.validateSync(); | |
assert.equal(error.errors['name'].message, | |
'Path `name` is required.'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment