Exactly Same Query Behaving Differently in Mongo Client and Mongoose
Understanding Mongoose's strict schema handling
You might notice that the same query behaves differently in a MongoDB client, like Compass or mongo shell, compared to when using Mongoose within a Node.js application. Below is one such scenario.
[Read More]MongoDB Single Update Query to Change the Field Name in All Matching Documents of the Collection
Including field name in nested object and array of objects.
JavaScript Unit Testing JSON Schema Validation
AWS Layer: Generate nodejs Zip Layer File Based on the Lambda's Dependencies
We want to create an AWS layer zip file containing all the node_modules
used by a particular AWS lambda function.
In Node JS HTML to PDF conversion, Populate Images From URLs
Using axios and base64 conversion
In continuation of my previous post Convert HTML to PDF in Node JS without headless browser, I will show you how can we can fetch the images from URL, convert them into base64 string, and populate them in the HTML that is then converted into PDF.
[Read More]Convert HTML to PDF in Nodejs
Without Puppeteer, phantomjs or any other headless browser.
To convert an HTML to PDF in the backend, you usually need a headless browser like Puppeteer or phantomjs. The downside of headless browsers is that they are resource intensive. If you need to convert an HTML in Nodejs, is there a way to do so without them? The answer is yes but with a caveat: The HTML should be relatively simple, and you will only have a few options to style the document.
[Read More]Reduce JS Size With Constant Strings
Refactor for micro-optimization of frontend packages, scripts, and bundles.
Do Repeated string literals in the JavaSript codebase increase the final file size? Yes, they do. Does it matter? Not for the backend applications, but for frontend applications – and anything that contributes towards them – it does. For example, npm packages and directly loaded scripts, server-side rendered web applications, and SPAs such as Angular, React, and Vue.
[Read More]Remove Whitespaces Between Markdown Markers
To fix Bold, Italic, and Strikethrough tags.

Markdown spec outlines markers, such as the asterisk (*
), underscore (_
), and double tilde (~~
), for bold, italic and strikethrough, (or otherwise known as strong, emphasis, and delete), but requires these markers to wrap the text content on left and right without any whitespace(s). Any space on either side makes the markers appear as is instead of valid HTML tags after parsing/translation.