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 to some cloud log management service, such as papertrail.
[Read More]
Scrape Website Data Without Headless Browser, Using Node Js
Not Every Website Scraping Needs Headless Browsers; Request And Cheerio Js Do Just Fine
During the course of web development, we occasionally need to scrape a website. Not just one page but many. On such requirement, mostly because the host site does not allow otherwise, we naturally tend to favor the use of headless browsers such as phantomjs or casperjs.
[Read More]
With Update Method, Toggle Boolean Field in All Documents of a MongoDB Collection
Recently, I got a situation in which I had to update all user documents in mongoDB to toggle a boolean field. I was looking for single update query that could take care of it, but being a rare need, the problem had not many helpful solutions.
[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]
Validate Uploaded CSV Data in Node Express
Confirm existence and data type of all columns within each row.
Continuing from earlier post Node Express Endpoint to Upload and Process CSV File, in this post we will add validation to the uploaded CSV data.
With the same index.js file and settings as the earlier post, we only need to add moment library for date validation.
[Read More]
Integrate Polling Based API In Node/Express Js
At times we need to integrate in our Node/Express application third party APIs that have implemented polling mechanism i.e. they only send back results once available; the client must keep on attempting until the service has put together all the results to return.
[Read More]
NoSQL Many-to-Many Relationship Examples; Bound and Unbound Cases
Right Approach to Modeling Many to Many Relations and Use of Associative Collection
In NoSQL data modeling I analyzed NoSQL data modeling and ways to model many to many relationships. In another post I added a few examples of 1-to-many bound and unbound cases.
[Read More]NoSQL One-to-Many Relation Examples; Bound and Unbound Cases
What Are the Options to Properly Model 1-to-Many Scenarios and Which One is Right?
In NoSQL data modeling post, I have explained NoSQL data modeling and that there are three ways to model one to many relationships. In this post, I will list real-world examples of one to many relationship — both bound and unbound — in which application of different ways of modeling are possible (or not).
[Read More]NoSQL Example of Separate Collections in One-to-One Relationship; Case of Specialization and Generalization
When and Why Should Reference Be Used to Link Documents in 1-1 Relation.
In my detailed post on NoSQL data modeling, I listed down ways of modeling NoSQL data (using mongodb collections). For one-to-one relation, usually, it is not apparent why one needs a separate collection instead of embedding everything in single document.
[Read More]
When you purchase through links on techighness.com, I may earn an affiliate commission.