DEV Community

Hridoy roy
Hridoy roy

Posted on

Blog About Newly Learned Technology

I explored Mongoose as a new technology for our team project since I hadn’t used it before. MongoDB, our previous choice, lacked data validation before insertion, prompting us to switch to Mongoose.

Mongoose is an open source library created just for MongoDB Database which uses the complex tasks of MongoDB Database which were done manually with MongoDB Drive can be easily done using Mongoose. As Bootstrap is for HTML, CSS, Mongoose is for MongoDB database! 💁🏻

Mongoose simplifies database-server connections using mongoose.connect(uriString, {dbName: ‘test-db’}). It allows us to create flexible data structures with mongoose.Schema(), accepting various input types (String, Number, Boolean, enum, Array, Date, etc.). We require these fields to ensure data integrity.

To build a data model, we use mongoose.model() after defining the schema. It’s essential to follow JavaScript class conventions. Custom methods for schemas can be added with schema.method = {}.

I’m currently delving deeper into Mongoose. Thanks for reading my blog!

Top comments (0)