16. Using Mongoose for Structured Schema and Validation

Now that you understand the MongoDB Node.js 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 to apply a structured schema to a MongoDB collection, which provides the benefits of validation and type casting.

Mongoose simplifies 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 module and how to use it to implement a structured schema and validation on your collections. You will be introduced to new objects and a new way of implementing MongoDB in your Node.js applications. Mongoose really doesn’t replace the MongoDB Node.js native driver; rather, it enhances it with additional functionality.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.169.178