Mongodb
Mongoose Discriminator: The non DRY way to inherit schema properties
Mongodb

Mongoose Discriminator is another very useful and powerful yet underused feature of Mongoose. It serves as a means of schema inheritance, allowing you to use multiple models with intersecting schemas on the same underlying MongoDB collection. You can store different entities in one collection, and you will still be able to discriminate between these entities. Unfortunately, the documentation of this feature is poor.

Mongodb
Understanding Mongoose Pre and Post middleware hooks
Mongodb

Pre and post middleware hooks is a very useful feature in Mongoose and provides a lot of flexibility during database operations like query, create, remove etc. Pre and post hooks are functions that are executed before or after a particular action that you specify. These hooks get triggered whenever you perform an operation with your database.

Mongodb
Optimize Mongoose Queries for Speed & Efficiency: The Lean Way
Mongodb

Mongoose is a schema-based solution to model your application data in MongoDB. It includes built-in type casting, validation, query building, business logic hooks and more, out of the box.

mongoose lean

Javascript
Deep dive into Object.freeze() in Javascript
Javascript

According to MDN, the Object.freeze() static method freezes an object. Freezing an object prevents extensions and makes existing properties non-writable and non-configurable. A frozen object can no longer be changed: new properties cannot be added, existing properties cannot be removed, their enumerability, configurability, writability, or value cannot be changed, and the object’s prototype cannot be re-assigned. freeze() returns the same object that was passed in.

Nodejs
Why Pino with Logrotate is the Best for Managing Logs in Nodejs Apps
Nodejs

Log files are very useful to troubleshoot, to track usage, improve performance, and monitor the overall health of the application. However, over time, they become large and use up valuable disk space. It not only makes debugging harder but also slows down the application as writing new log lines become expensive operation. This is where log rotation is required.