Understanding Mongoose Pre and Post middleware hooks

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.

How to make Mongoose Queries faster & less memory intensive (The Lean Way)

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 offers various methods to retrieve documents from a collection, such as find(), findOne(), and findById().

Deep dive into Object.freeze() in 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.

Pino with Logrotate is the best way for managing logs in your Nodejs application

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.

Setup logging with Pino and express-http-context in Expressjs

Logging is an essential tool for debugging and understanding the behavior of your application. It allows developers to capture information about the state and flow of an application, which can be used to identify and fix bugs, improve performance, and monitor the overall health of the application.