16Using Mongoose for Structured Schema and Validation
Now that you understand the native driver, it won’t be hard to make the jump to using Mongoose. Mongoose is an Object Document Model (ODM) library that provides additional functionality to the MongoDB Node.js native driver. For the most part, it is used as a way to apply a structured schema to a MongoDB collection. This provides the benefits of validation and type casting.
Mongoose also attempts to simplify some of the complexities of making database calls by implementing builder objects that allow you to pipe additional commands into find, update, save, remove, aggregate, and other database operations. This can make it easier to implement your code.
This chapter discusses the Mongoose ...
Get Node.js, MongoDB and Angular Web Development, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.