March 2018
Intermediate to advanced
592 pages
13h 44m
English
Now in order to get started, we're going to pull up two pages in the Mongoose documentation, just so you know where this stuff lives if you ever want to dive deeper in the future. First up, we're going to look up the validators. I'm going to google mongoose validators, and this is going to show us all of the default validation properties we have built in:

For example, we can set something as required, so if it's not provided it's going to throw an error when we try to save that model. We can also set up validators for things like numbers and strings, giving a min and max value or a minlength/maxlength value for a string. ...