Image for post
Image for post
Photo by Green Chameleon on Unsplash

I am decided to take my AWS Certified Cloud Developer Associate exam in the coming March 2021. Thus, I am taking a course now on Udemy and prepare myself for the exam.

This post summarized the key points of learning on AWS Regions and Availability Zones. Besides, I have also made a mind map for easier revision afterward. Without further ado, let’s start.

Region

AWS introduced the concept of the region where it is actually a cluster group of data centers in a certain location

For example, we have regions such as Asia Pacific Southeast (Singapore), US East (Ohio) and etc.


Image for post
Image for post

Scenario

Imagine you’re a DevOps engineer and you are responsible to grant access to the database, which could be known as Database Administrator as well.

However, it’s a new year and your company management decided to restructure the team. Someone from the team trying to change his role. For example, “ devA” from the backend team would like to try to do different stuff in his career and he decides to switch to the frontend team.

The management informs you to revoke his database privileges as he previously offered access to the database. …


Image for post
Image for post

Scenario

Imagine you’re a DevOps engineer and you are responsible to grant access to the database, which could be known as Database Administrator as well.

However, it’s a new year and your company management decided to promote some of the potential team members to become the team leaders. 🎉🎉🎉

As you all known:

With great responsibility comes great power. — Mark Manson

The management informs you to update their database privileges as they previously offered read-only access to the database. If you’re interested in how to create a read-only role for MongoDB, please read the post here. …


Image for post
Image for post
Photo by Luiza Braun on Unsplash

This post discussed how to create a read-only role in the MongoDB database. Without further ado, let’s start.

Scenario

Imagine you’re a DevOps engineer or the team leader for the Backend team, normally these roles are the role to grant access to the database.

There are two newly hired developers who just joined your team and the management decided to provide a read-access only to the database in the staging environment in order to ease the debugging workflow. Let's call them Developer A and Developer B.

Here is the list of Mongo databases that is available.


Image for post
Image for post
Photo by Christina Rumpf on Unsplash

This post talked about one of my experiences in code review and ultimately lead me to the discovery of the difference between Array.isArray and Lodash _.isArray. Without further ado, let’s start the story.

Introduction

The story starts by beginning sending a merge request for review in Gitlab. It is similar to the pull request you known in Github.

In the code itself, I am using lodash isArray to check the variable. Refer the below code snippet.

const { isArray } = require('lodash');​const requiredFields = getRequiredFields();​if (isArray(requiredFields)) {
return requiredFields;
} else {
// do something else
}

At this…


Image for post
Image for post
Photo by Azharul Islam on Unsplash

This post discussed how I use jest-in-case library to write more organized tests. However, there is a pre-requisite to use this library you probably guess it right.

If you’re using Jest to write your test, then this post is probably going to be helpful to you.

“I don’t know about you, but lots of times when I write even slightly generic functions, I have lots of test cases that are basically the same test over and over with different values.” — Jamie Kyle

The above statement resonates with me a lot especially when I started to face the situation where…


Image for post
Image for post
Photo by Carl Heyerdahl on Unsplash

This post discussed why I choose to use git alias and how it improves the overall work productivity and save some time for me.

If you’re the one who prefers to use IDE such as Github Desktop, Fork, and others, then this article might not suitable for you. However, you can continue to read to see whether I can persuade you to use the git command instead.

If you don’t know about Git Alias

Git alias allows you to create shortcuts for your frequently used Git commands. Here are some of my favorites and commands I used the most.

git checkout => git co // My shortcut


Image for post
Image for post
Photo by Ferenc Almasi on Unsplash

Writing Unit Tests has become a daily task for a software engineer. There are several purposes of writing unit test:

  • Better Product Experience & Quality. Companies want to launch products with lesser issues.
  • Time-Saving. Ensure the developed enhancement work as expected, reduce the Ding-Dong game so we can reduce the bug-fixing time that operation time. For e.g, QA -> Dev -> QA ->Dev ->QA -> Deployment.
  • Improve the Engineer’s confidence. If you write unit tests, you would probably gain more confidence along the process for anything you developed and released.

Since unit tests lead to so many benefits, but why…


Image for post
Image for post
Photo by Matt Eason on Unsplash

This post discussed how you can perform upsert with Mongoose. Upsert is the combination of insert and update, if it is a new record, it will perform the CREATE operation while if the existing record found, it will UPDATE on the existing record.

Without further ado, let’s start.

Upsert in Mongoose

Learning is enhanced with a real case study. Imagine that you are the Backend Developer for a job portal. Here is the given requirement:

  • Candidates are able to add new working experience and edit their existing working experiences.

We can easily use the API provided by Mongoose findOneAndUpdate to perform the…


Image for post
Image for post
Photo by Greg Rakozy on Unsplash

This article documented down on how to skip to the next iteration when you’re using foreach. Besides, you will also know the correct scenario to use foreach.

Without further ado, let’s start.

Easily skipping forEach loop

Skipping a foreach loop is easy. Simply using return when it is matching the condition. Refer to the code below.

const arr = ['Peter', 'Sam', 'Helena'];​arr.forEach((name) => {
if (name === 'Helena') {
return;
}
console.log(`Person name: ${name}`);
});

Output

"Person name: Peter"
"Person name: Sam"

With this example, we’re skipping the loop when the iteration reached “Helena”.

However, are we using forEach in all the scenarios…

Tek Loon

Coder and Writer. Read my blog — https://tekloon.dev.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store