Member-only story
MongoDB Performance 101: How To Improve the Speed of MongoDB App
Indexing with real-life use cases
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:
- Booking No. (Flight Booking Number)
- Family Name/Surname
- Given Name
- Date of Birth
- Email Address
I have also provided a screenshot below.

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.