When the terms mongoose comes, it definitely makes a question in our mind what that exactly is and from where it comes! Today we are going to discuss Mongoose.

Mongoose is an Object Data Model(DOM) for MongoDB. It manages the relationship between data, provides schema validation and so many special features

Mongoose Schema validation and Model

const mongoose = require(“mongoose”); and you can access a Class from mongoose like const {Schema} = mongoose;

Then you can design whatever schema you want. After creating a schema you can make a model for your collection.

such as const Todo= mongoose.model(“Todo”, todoSchema).

After that, you can export it from your file and can use it anywhere you want.

Mongoose statics and methods

Mongoose provides some special things that really help a developer to code with flexible and developer-friendly code.

--

--