Mongoose validators

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.

The other page we're going to look at is the Schemas page. To get to this, we're going to google mongoose schemas. This is the first one, the guide.html file:

On this page, you're going to see something slightly different from what we've been doing so far. They call new Schema, setting up all of their properties. This is not something we've done yet, but we will in the future. For now, you can consider this object, the Schema object, identical to the one we have over in Atom that we pass in as the second argument to our mongoose.model call.