MongoDB Interview Questions
Part of the MERN Stack Roadmap
In short
MongoDB questions in MERN interviews come from a fairly small pool: documents vs tables, embedding vs referencing, indexes, aggregation, transactions and populate. If you can explain each with a quick example, you are well prepared.
MongoDB questions usually cover documents vs tables, embedding vs referencing, indexes, the aggregation pipeline, transactions and how Mongoose populate works.

Think of it like this
Packing for a trek
Before a Himalayan trek you don't pack your whole house. You pick the few things that matter and know exactly where each one is. MongoDB interview prep is the same: a small set of concepts, each with one clear example you can pull out instantly.
Watch it happen
The topics that come up most
1/5Most questions fall into four areas.
The big ideas
What you need to know
Documents vs rows
Documents are flexible JSON-like records that can nest data. Design around how the app reads data, not around normal forms.
Embed or reference
Embed small data that is read together and bounded, like addresses. Reference data that is large, shared or grows without limit, like orders.
Indexes
Single, compound (order matters: equality, then sort, then range), unique and text. Each index speeds reads but slows writes.
populate vs $lookup
populate is Mongoose running extra queries in Node. $lookup is a join done inside MongoDB within an aggregation.
See it in code
Walk through the code
1// "Top 5 cities by delivered revenue this year, with customer count"2db.orders.aggregate([3 { $match: { status: "delivered", createdAt: { $gte: ISODate("2026-01-01") } } },4 {5 $group: {6 _id: "$shipping.city",7 revenue: { $sum: "$total" },8 customers: { $addToSet: "$userId" },9 },10 },11 { $project: { _id: 0, city: "$_id", revenue: 1, customerCount: { $size: "$customers" } } },12 { $sort: { revenue: -1 } },13 { $limit: 5 },14]);15 16// Follow-up: "Make the $match fast"17db.orders.createIndex({ status: 1, createdAt: 1 });1/5Filter first so later stages process fewer documents. $match at the start can use an index.
A classic whiteboard aggregation, plus the index that supports its first stage.
Save yourself the pain
Common mistakes
Oops
Saying "MongoDB has no relations, so I embed everything".
Do this instead
Explain the trade-off: embed bounded data read together, reference unbounded or shared data, and give an example of each.
Oops
Answering "add an index" for every slow query without checking.
Do this instead
Say you would run explain("executionStats"), compare docs examined with docs returned, then design the index.
Oops
Claiming MongoDB has no transactions.
Do this instead
Multi-document ACID transactions have been available since MongoDB 4.0 on replica sets. They cost performance, so use them only where needed.
Your mission
Answer out loud
Quick check
A blog post can have thousands of comments that keep growing. How should you store comments?
Go deeper
- 1Write an aggregation pipeline for top products by revenue from memory.
- 2Explain when you would embed and when you would reference.
- 3Describe how you would find and fix a slow query.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.