This chapter introduces Mongoose, which provides a structured schema to a MongoDB collection that provides the benefits of validation and typecasting. You’ve learned about the new Schema
, Model
, Query
, and Aggregation
objects and how to use them to implement an ODM. You’ve also used the sometimes more friendly Mongoose methods to build a Query
object before executing database commands.
You have also learned about the validation and middleware frameworks. The validation framework allows you to validate specific fields in the model before trying to save them to the database. The middleware framework allows you to implement functionality that happens before and/or after each init
, validate
, save
, or remove
operation.