How to increase the performance of MongoDB query by 3x?

Most of the developers are using the mongoose rather than the MongoDB native driver.

The main difference between them is mongoose uses the Object Relational Model(ORM) and MongoDB native driver uses the Object Document Mapping(ODM).

MongoDB native driver has excellent performance than the mongoose.

But when you don’t want to switch your mongoose then use Lean property of mongoose for better performance

Mongoose Lean: It returns plain javascript object in the response to the query fired on the MongoDB. Default it is false that’s why mongoose returns all its mongoose document in the response of MongoDB query and it has getter setter and other events of the query response. That’s why it takes a lot of time when your data is more than the thousands of records. But when we set lean property to true then it will only give the pain javascript object. See more description on

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.