E-Commerce Product Catalog — NoSQLVerse Project
E-Commerce Product Catalog — NoSQLVerse Project: free step-by-step lesson with examples, common mistakes, and interview tips — part of MongoDB Tutorial on Toolliyo Academy.
On this page
MongoDB Tutorial · Lesson 92 of 100
E-Commerce Product Catalog
Foundations & CRUD ✓ → Queries & Schema ✓ → Aggregation & Scale ✓ → Atlas & Projects
Atlas & Projects · 4 — Build · ~10 min · MongoDB — Real-World Projects
What is this?
An e-commerce catalog stores products, categories, and optionally inventory. Documents hold attributes, price, and search fields. Orders snapshot line items at purchase time.
Why should you care?
Flipkart-scale browsing needs flexible specs, fast filters, and correct historical prices on invoices.
See it live — copy this example
Open mongosh or MongoDB Compass, select database nosqlverse, then run the example. Change one field and run again.
db.products.insertOne({
sku: "TV-55-4K",
name: "55 inch 4K TV",
category: "electronics",
price: 42999,
attrs: [{ k: "refreshHz", v: 120 }, { k: "os", v: "AndroidTV" }],
stock: 25,
active: true
})
db.products.createIndex({ category: 1, price: 1 })
db.products.createIndex({ "attrs.k": 1, "attrs.v": 1 })
db.products.find({ category: "electronics", price: { $lte: 50000 }, active: true }).sort({ price: 1 })
db.orders.insertOne({
items: [{ sku: "TV-55-4K", name: "55 inch 4K TV", unitPrice: 42999, qty: 1 }],
total: 42999,
status: "placed"
})
Run Example »
Edit the code below and click Run to see the result in Toolliyo’s live editor.
What happened?
- products uses attribute pattern for specs and compound indexes for browse.
- orders snapshots name/price so later catalog edits do not rewrite history.
- active filters hide drafts.
Practice next
- Insert 5 products across categories.
- Query a price-filtered category list.
- Place an order with snapshots.
- Add Atlas Search on name/description.
- updateMany stock decrements carefully with $inc.
Remember
Flexible product docs + browse indexes. Snapshot prices on orders. Attrs handle sparse specs.
Festival electronics aisle
Shoppers filter TVs under ₹50,000 with 120Hz panels via attrs.
Outcome: Catalog API returns the right grid with stable invoice history.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!