Additional Objects
Mongoose sits on top of the MongoDB Node.js native driver and extends its functionality in a couple of different ways. First, it adds some new objects—Schema, Model, and Document—that provide the functionality necessary to implement the ODM and validation.
You use the Schema object to define the structured schema for documents in a collection. It allows you to define the fields and types to include, uniqueness, indexes, and validation. The Model object acts as a representation of all documents in a collection. The Document object acts as a representation of an individual document in a collection.
Mongoose also wraps the standard functionality used for implementing query and aggregation parameters into the new objects Query ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access