Welcome to my first and world’s yet another technology blog

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’ve explained NoSql data modeling and that there are three ways to model one to many relationships. In this post I’ll 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). One To Many Bound Let’s take an example of Restaurant has many Workers. If we analyse this relation it’s obvious that it’s bound by an upper limit. [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’s not apparent why one needs a separate collection instead of embedding everything in single document. In this post I’ll address this and share an example. University/School Example Keeping our example real-world but simple, let’s model a university or school. A few obvious entities emerge: Student [Read More]

Unit Testing Expressjs Controller (Part 2)

Detailed Example Of Express Mongoose Update API

This is part 2 on the topic of Expressjs controller unit testing. Previously I added unit tests for 5 basic CRUD APIs for vehicle. In this post I’ll show one more example, where controller logic gets a little longer. If you haven’t already, please check part 1 before continuing as I’ll build upon the same controller and spec files. You can also get the full code from github repository . [Read More]

Unit Testing Expressjs Controller (Part 1)

Stepwise Test Driven Development of Express Mongoose CRUD APIs

So far, I haven’t found a real workable example of unit testing Express controller/route for API. Most I saw either label integration test as unit test or offer little meaningful in right direction. To be clear what I’m talking about, see the controller code below: Controller.create = function (req, res) { return Vehicle.create(req.body, function (err, vehicle) { if (err) { return res.status(500).end(); } else { return res.json(vehicle); } }) }; This is the simplest of controller (or route) functions we would like to unit test. [Read More]

Develop Two Player Chess Game Application with React Js

With React js, development of two player chess application is a breeze. This tutorial assumes working knowledge of Javascript ES6 and React js. The application’s code is bootstrapped with create-react-app. The initial setup and stylesheet are taken from and built upon React’s official tic tac toe tutorial. Full code for the game can be found here. To play, head to demo. Setup To go along, create an application by following the steps at create-react-app. [Read More]

Why I Chose Hugo Framework For My First Blog?

A journey of exploring various CMSs, website builders and static site generators before settling on Hugo

If you’re an over-thinker like me, you’re bound to share my experience ahead of launching your first blog. The most strenuous part is platform selection. Wordpress.org? Wordpress.com? Squarespace? Wix? Hubpages? A never ending cycle begins: Weigh pros and cons of each and choose one, only to start over again on second-guessing. Web development background doesn’t help either. It only presents more options like static website generators such as Hugo and Jekyll (though equally accessible to non-developers), and non-wordpress systems like Keystone. [Read More]

Node Express Endpoint to Upload and Process CSV File

It’s very common in Node/Express backend development to come across a requirement of parsing and processing CSV file. Perhaps storing the content in database after processing. This post will do just that. We’ll upload a CSV file, store it temporarily in server’s directory to fetch all rows in JSON form, push all rows in an array, and remove the temporary file. Let’s jump straight into it. Here are the steps: [Read More]

How To Draw NoSql Data Model Diagram?

NoSql, unlike SQL which has ER and class diagrams, has neither names nor constraints for data modeling diagram(s). The obvious reason is NoSql’s lack of hard and fast relationship rules, which aims to get a developer started with minimum requirements. Since data modeling diagram is the blueprint of any application we should always draw one. For tool I prefer draw.io, where you simply need to drag and drop symbols into the canvas and align them. [Read More]

NoSql Data Modeling: 1 to 1, 1 to Many, Many to Many

Surprisingly, data modeling for NoSql databases doesn’t get much traction compared with SQL. 1 to 1, 1 to many and many to many; all can be modeled multiple ways. No favoring of a particular choice, no required normalization. The only constraint is application requirements. Coming from SQL background, I struggled modeling Couchbase and MongoDb applications. Though badly put together at the time, Couchbase documents were of great help. In this post I’m sharing my understanding and way of approaching this problem with some examples. [Read More]