Better Programming

Advice for programmers.

Follow publication

Member-only story

MongoDB Performance 101: How To Improve the Speed of MongoDB App

Tek Loon
Better Programming
Published in
8 min readOct 3, 2019

--

Photo by Christian Wiediger on Unsplash

This article was inspired by when I followed along with the MongoDB Performance Course by MongoDB University. The course offered a lot of insight to me about where I can improve and how to optimize queries in real production projects.

In this article, I will be sharing a simple, common but practical use case to improve MongoDB performance.

Before I start, there are some tools that I’ll be using in this article:

  • MongoDB (Of course. We’re talking about MongoDB Performance Optimisation)
  • MongoDB Compass (GUI for MongoDB)

Use Case: AirAsia AVA Chatbot

Before I get started, there are some disclaimers that I want to make:

  • I do not work at AirAsia.
  • What I suggest and wrote here is just my personal opinion and interpretation, which means I could be wrong.

Introduction

The story begins when I booked a flight to Korea in the coming November via AirAsia. However, I had to cancel the flight due to personal reasons, and the cancellation had to be performed via AVA chatbot.

In order to perform the refund, it requires the user to provide certain information in a sequential manner:

  1. Booking No. (Flight Booking Number)
  2. Family Name/Surname
  3. Given Name
  4. Date of Birth
  5. Email Address

I have also provided a screenshot below.

AVA Chatbot Korea refund flow

Now we understand the refund flow and what information it requires. Let’s design and mock-up the database.

Data preparation

This section explains how I prepare the database model and load the dummy data into our collection for performance optimization in the later phase. If you’re coming from an SQL background, collection can be known by a table as well.

--

--

Tek Loon
Tek Loon

Written by Tek Loon

Coder and Writer. If you enjoy my stories— support me by https://www.buymeacoffee.com/tekloon so I can keep writing articles for the community.

No responses yet

Write a response