From the course: Databases for Node.js Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Introduction to Mongoose

Introduction to Mongoose

From the course: Databases for Node.js Developers

Start my 1-month free trial

Introduction to Mongoose

- [Instructor] Ever since the beginning of database programming developers are trying to build abstraction layers to simplify using them. Especially with object oriented programming, manipulating the database using rock theories while everything else is modeled with objects, feels somewhat unnatural. For document databases, this is what an Object Document Mapper, short, ODM does. And the most frequently used ODM for no chess is Mongoose. So let's look at the basic example about ODM stoop. Let's imagine we have a collection that stores cars and the car is represented by a make, a model and the year. Now with an ODM, I can create a new instance of car and pass in these properties as an argument. The resulting object would then look somewhat like this. So it's an object with three properties make, model, year and it also has this save method. So this save method now contains all the logic that is needed to actually save or…

Contents