This repository contains an exercise to explore the differences between relational (PostgreSQL) and MongoDB paradigms through an e-commerce application schema design. This exercise explores the different approaches to schema design between relational and document-based databases, focusing on how MongoDB's document model can provide flexibility advantages particularly useful when dealing with evolving application requirements.
E-commerce applications frequently evolve with changing business requirements - new product types, promotion strategies, customer attributes, and order processing workflows. In traditional relational databases like PostgreSQL, these changes often require schema modifications, migration scripts, and application code updates. MongoDB's flexible document model offers a different approach that can significantly reduce development friction during these evolutionary phases.
By completing this exercise, you will:
- Gain practical experience setting up both MongoDB and PostgreSQL locally
- Learn how to translate relational schemas to MongoDB schemas
- Understand MongoDB schema design patterns and when to apply them
- Experience firsthand how MongoDB handles schema evolution compared to relational (PostgreSQL)
mongo/
docker-compose.yml
- Configuration to set up MongoDB container
psql/
docker-compose.yml
- Configuration to set up PostgreSQL container
LICENSE
- License informationREADME.md
- This file
- Download Docker Desktop for Mac from Docker Hub
- Double-click the downloaded
.dmg
file and drag the Docker app to your Applications folder - Open Docker from your Applications folder
- When prompted, authorize Docker with your system password
- Once Docker Desktop is running, you should see the Docker icon in the status bar
- Download Docker Desktop for Windows from Docker Hub
- Double-click the installer to run it
- Follow the installation wizard
- When prompted, ensure the "Use WSL 2 instead of Hyper-V" option is selected (recommended)
- Click Apply & Restart after installation
- Start Docker Desktop from the Windows Start menu
Open a terminal or command prompt and run:
docker --version
docker-compose --version
Links to individual set-up steps and their corresponding guides:
-
Understanding the E-commerce Data Model - Overview of the e-commerce application structure using the LucidChart diagrams and relational schema.
-
MongoDB Schema Solution - A sample MongoDB schema design for the e-commerce application with explanations of design decisions and pattern usage.
-
Setting Up MongoDB and PostgreSQL Locally - Complete instructions for setting up both databases using Docker containers.
-
Schema Evolution Scenarios - Practical scenarios for testing schema flexibility in both databases.