Clean Up MongoDB Of Old Inactive Users And Their Data With Node Js Script

Reduce Expensive Database Space By Pruning Never-To-Be-Used-Again Data

Databases are not cheap, especially when your application is just taking off and you are low on budget. It is then that freeing up retrievable and precious space from the database is a good way to save some dollars for a while. [Read More]

Build Queue For Processing Webhooks With Node Js And MongoDB

Manage The Flood Of Webhooks With A Database Queue

Many of the third party services we integrate in our applications use webhooks to communicate events to us. Responding to the incoming webhook with success response (status 200) is all that is required to acknowledge the receipt of the webhook. To process that webhook immediately upon receiving or entering it in a queue to be processed later is up to you.

[Read More]

Intercept Node Js Console Log And Insert In Mongodb

Easily Manageable And Searchable Application Logs Stored In Database

Your node js application is running on production, leaving hard-to-search ever-increasing log files in its wake. You want all your logs in a centralized, easily searchable place. For that, you have two options: 1 - Buy a subscription of some cloud log management service, such as papertrail. [Read More]

Export MongoDB Collection Data In CSV From Node Express Mongoose Application

Suppose a student collection in mongoDB have some data that we want to export in a CSV file from a Mongoose, Node, and Express app. For simplicity, let us assume only two fields in Mongoose schema: lastName and firstName. To export a CSV file, install moment, json2csv, and mongo-date-query (optional) npm packages: [Read More]