Chapter 5. Introduction to Mongoose
Mongoose is a robust Node.js ODM module that adds MongoDB support to your Express application. Mongoose uses schemas to model your entities, offers predefined validation along with custom validations, allows you to define virtual attributes, and uses middleware hooks to intercept operations. The Mongoose design goal is to bridge the gap between the MongoDB schemaless approach and the requirements of real-world application development. In this chapter, you'll go through the following basic features of Mongoose:
- Mongoose schemas and models
- Schema indexes, modifiers, and virtual attributes
- Using the model's methods and perform CRUD operations
- Verifying your data using predefined and custom validators
- Using middleware to intercept the model's methods