Summary
In this chapter, we've seen how to use Mongoose to maintain the data integrity of our application. We have learned about the default validators that are available, and also learned how to use them and how to create custom validators. Within the custom validators, we've covered how to send custom error messages, add multiple validators, and run asynchronous validation. We also took a look at the error object returned when your validators find a problem with the data.
Coming up in the next chapter, we're going to take a look at complex schemas, including nested documents and referencing other schemas.