Search⌘ K
AI Features

Comprehensive MongoDB Database: E-Commerce Platform

The e-commerce database for practicing MongoDB consists of six collections: customer profiles, product details, pricing audits, filtered furniture products, customer orders, and orders with date inconsistencies. Each collection contains specific attributes essential for managing an online retail platform, such as unique IDs, contact information, product details, and order records. Understanding this structure is crucial for executing real-world MongoDB queries effectively.

Database structure: E-commerce database

To practice the basics of MongoDB, we’ll gain hands-on experience with a database for an e-commerce platform that sells products online. The name of the database is ecommerce, and it has six collections:

  • customers.json is a dataset containing customer profiles with unique IDs, contact details, addresses, and their total number of orders.

  • products.json is the main product master catalog containing complete product details such as unique IDs, names, categories, brands, prices, stock levels, tags, availability status, and customer ratings.

  • products_price.json is a pricing audit dataset derived from the main catalog, specifically focused on product price validation. It includes the same core product details but highlights items with zero or missing prices to support data quality checks and price correction workflows.

  • products_furniture.json contains a filtered list of furniture products with their IDs, names, brands, prices, stock levels, tags, status, and customer ratings.

  • orders.json contains customer order records with order IDs, linked customer IDs, purchased items, total order value, order status, and the date each order was placed.

  • orders_wrongDates.json is the same as orders.json, but with inconsistent or non-ISO-formatted orderDate fields.

Database in action

It’s essential to review the database before practicing interview questions on it.

MongoDB database
[
{
"_id": "65a0d3f91a76e23e4eac8c72",
"name": "Laptop",
"category": "Computers",
"brand": "Dell",
"price": 1200,
"stock": 35,
"status": "Active",
"tags": ["electronics", "computing", "portable"],
"rating": 4.7
},
{
"_id": "65a0d3f91a76e23e4eac8c73",
"name": "Keyboard",
"category": "Accessories",
"brand": "Logitech",
"price": 75,
"stock": 120,
"status": "Active",
"tags": ["peripherals", "input", "wired"],
"rating": 3.2
},
{
"_id": "65a0d3f91a76e23e4eac8c74",
"name": "Mouse",
"category": "Accessories",
"brand": "Logitech",
"price": 45,
"stock": 160,
"status": "Active",
"tags": ["peripherals", "input", "wireless"],
"rating": 4.5
},
{
"_id": "65a0d3f91a76e23e4eac8c75",
"name": "Monitor",
"category": "Displays",
"brand": "Samsung",
"price": 750,
"stock": 45,
"status": "Active",
"tags": ["electronics", "display", "HD"],
"rating": 2.9
},
{
"_id": "65a0d3f91a76e23e4eac8c76",
"name": "Webcam",
"category": "Accessories",
"brand": "Logitech",
"price": 99,
"stock": 80,
"status": "Active",
"tags": ["camera", "video", "meetings"],
"rating": 3.8
},
{
"_id": "65a0d3f91a76e23e4eac8c77",
"name": "Printer",
"category": "Office Equipment",
"brand": "HP",
"price": 185,
"stock": 40,
"status": "Active",
"tags": ["printing", "office", "inkjet"],
"rating": 4.1
},
{
"_id": "65a0d3f91a76e23e4eac8c78",
"name": "Tablet",
"category": "Computers",
"brand": "Apple",
"price": 650,
"stock": 50,
"status": "Active",
"tags": ["mobile", "touchscreen", "electronics"],
"rating": 4.9
},
{
"_id": "65a0d3f91a76e23e4eac8c79",
"name": "Wireless Earbuds",
"category": "Audio",
"brand": "Sony",
"price": 10,
"stock": 90,
"status": "Active",
"tags": ["audio", "wireless", "bluetooth"],
"rating": 4.0
},
{
"_id": "65a0d3f91a76e23e4eac8c7a",
"name": "Microphone",
"category": "Audio",
"brand": "Blue",
"price": 110,
"stock": 55,
"status": "Active",
"tags": ["recording", "sound", "streaming"],
"rating": 3.4
},
{
"_id": "65a0d3f91a76e23e4eac8c7b",
"name": "External Hard Drive",
"category": "Storage",
"brand": "Seagate",
"price": 95,
"stock": 100,
"status": "Active",
"tags": ["storage", "backup", "usb"],
"rating": 4.6
},
{
"_id": "65a0d3f91a76e23e4eac8c7c",
"name": "USB Hub",
"category": "Accessories",
"brand": "Anker",
"price": 35,
"stock": 180,
"status": "Active",
"tags": ["usb", "connectivity", "expansion"],
"rating": 2.1
},
{
"_id": "65a0d3f91a76e23e4eac8c7d",
"name": "HDMI Cable",
"category": "Cables",
"brand": "Belkin",
"price": 25,
"stock": 200,
"status": "Active",
"tags": ["video", "cable", "connectivity"],
"rating": 3.7
},
{
"_id": "65a0d3f91a76e23e4eac8c7e",
"name": "Desk Lamp",
"category": "Office",
"brand": "Philips",
"price": 60,
"stock": 90,
"status": "Active",
"tags": ["lighting", "desk", "home"],
"rating": 4.2
},
{
"_id": "65a0d3f91a76e23e4eac8c7f",
"name": "Laptop Bag",
"category": "Accessories",
"brand": "Samsonite",
"price": 80,
"stock": 75,
"status": "Active",
"tags": ["travel", "bag", "laptop"],
"rating": 3.6
},
{
"_id": "65a0d3f91a76e23e4eac8c80",
"name": "Smartphone",
"category": "Mobiles",
"brand": "Samsung",
"price": 999,
"stock": 40,
"status": "Active",
"tags": ["mobile", "android", "electronics"],
"rating": 4.8
},
{
"_id": "65a0d3f91a76e23e4eac8c81",
"name": "Gaming Chair",
"category": "Furniture",
"brand": "Secretlab",
"price": 420,
"stock": 25,
"status": "Active",
"tags": ["gaming", "chair", "comfort"],
"rating": 4.4
},
{
"_id": "65a0d3f91a76e23e4eac8c82",
"name": "Portable SSD",
"category": "Storage",
"brand": "Samsung",
"price": 150,
"stock": 85,
"status": "Active",
"tags": ["storage", "fast", "usb-c"],
"rating": 4.3
},
{
"_id": "65a0d3f91a76e23e4eac8c83",
"name": "Mechanical Keyboard",
"category": "Accessories",
"brand": "Razer",
"price": 140,
"stock": 50,
"status": "Active",
"tags": ["gaming", "keyboard", "rgb"],
"rating": 4.5
},
{
"_id": "65a0d3f91a76e23e4eac8c84",
"name": "Monitor Stand",
"category": "Office",
"brand": "Amazon Basics",
"price": 15,
"stock": 130,
"status": "Active",
"tags": ["office", "ergonomics", "monitor"],
"rating": 3.1
},
{
"_id": "65a0d3f91a76e23e4eac8c85",
"name": "Wireless Charger",
"category": "Accessories",
"brand": "Anker",
"price": 45,
"stock": 150,
"status": "Active",
"tags": ["charging", "wireless", "electronics"],
"rating": 4.0
},
{
"_id": "65a0d3f91a76e23e4eac8c86",
"name": "Smartwatch",
"category": "Wearables",
"brand": "Apple",
"price": 399,
"stock": 60,
"status": "Active",
"tags": ["wearable", "fitness", "smart"],
"rating": 4.9
},
{
"_id": "65a0d3f91a76e23e4eac8c87",
"name": "Noise Cancelling Headphones",
"category": "Audio",
"brand": "Bose",
"price": 299,
"stock": 55,
"status": "Active",
"tags": ["audio", "wireless", "noise-cancelling"],
"rating": 4.8
},
{
"_id": "65a0d3f91a76e23e4eac8c88",
"name": "Graphics Tablet",
"category": "Computers",
"brand": "Wacom",
"price": 249,
"stock": 35,
"status": "Active",
"tags": ["design", "drawing", "creative"],
"rating": 3.9
},
{
"_id": "65a0d3f91a76e23e4eac8c89",
"name": "Docking Station",
"category": "Accessories",
"brand": "Dell",
"price": 160,
"stock": 45,
"status": "Active",
"tags": ["usb-c", "expansion", "connectivity"],
"rating": 3.5
},
{
"_id": "65a0d3f91a76e23e4eac8c8a",
"name": "Ergonomic Mouse Pad",
"category": "Office",
"brand": "Fellowes",
"price": 825,
"stock": 200,
"status": "Active",
"tags": ["office", "ergonomic", "comfort"],
"rating": 3.3
},
{
"_id": "65a0d3f91a76e23e4eac8c8b",
"name": "Smart Speaker",
"category": "Smart Home",
"brand": "Google",
"price": 23,
"stock": 70,
"status": "Active",
"tags": ["home", "voice assistant", "smart"],
"rating": 4.6
},
{
"_id": "65a0d3f91a76e23e4eac8c8c",
"name": "Webcam Light Ring",
"category": "Accessories",
"brand": "Neewer",
"price": 60,
"stock": 85,
"status": "Active",
"tags": ["lighting", "video", "streaming"],
"rating": 3.7
},
{
"_id": "65a0d3f91a76e23e4eac8c8d",
"name": "Standing Desk",
"category": "Furniture",
"brand": "FlexiSpot",
"price": 499,
"stock": 20,
"status": "Active",
"tags": ["office", "furniture", "health"],
"rating": 4.2
},
{
"_id": "65a0d3f91a76e23e4eac8c8e",
"name": "Bluetooth Adapter",
"category": "Accessories",
"brand": "TP-Link",
"price": 23,
"stock": 140,
"status": "Active",
"tags": ["connectivity", "wireless", "usb"],
"rating": 3.8
},
{
"_id": "65a0d3f91a76e23e4eac8c8f",
"name": "Projector",
"category": "Displays",
"brand": "Epson",
"price": 799,
"stock": 18,
"status": "Active",
"tags": ["display", "home theater", "projection"],
"rating": 4.7
}
]

Feel free to explore the .json files in detail, by clicking the “Files” on the left side of the widget.

Now that we understand the structure of the e-commerce database, we’re ready to explore its collections and start running real-world MongoDB queries.