Skill Zuno · skillzunos.com · Fullstack
MongoDB interview questions
Prepare for MongoDB interviews on Skill Zuno. This practice book covers MongoDB interview questions across New, Easy, Medium, Hard, and Diff levels so you can work through real interview-style problems on skillzunos.com.
Open MongoDB on Skill ZunoAlso see the MongoDB tutorial.
MongoDB is a document database that stores data as flexible JSON-like BSON documents. It scales horizontally with sharding, provides high availability with replica sets, and supports rich queries, indexes and the aggregation pipeline. MongoDB interviews cover schema design, embedding versus referencing, indexes, aggregation, transactions and sharding.
Sample MongoDB interview questions
When should you embed documents and when should you reference them?
Embed data that is read together and owned by the parent, such as order lines in an order. Reference data that is shared, grows without limit, or is updated on its own, such as a customer used by many orders.
How do you choose a shard key?
Choose a key with high cardinality that spreads writes evenly and appears in most queries, so queries go to one shard. A monotonically increasing key such as a timestamp sends all inserts to one shard.
What is the ESR rule for compound indexes?
Order index fields as Equality first, then Sort, then Range. This lets one index filter by equality, return results already sorted, and then scan the range.
What is the aggregation pipeline?
A sequence of stages such as $match, $group, $sort, $project and $lookup that transform documents step by step. Put $match early so later stages process fewer documents and can use indexes.
Does MongoDB support transactions?
Yes. Single-document operations are always atomic, and since version 4.0 multi-document ACID transactions work on replica sets, and on sharded clusters since 4.2. They cost performance, so good schema design should make them rare.
What you can practice
- MongoDB interview questions for beginners and experienced developers
- Level-based practice: New, Easy, Medium, Hard, and Diff
- Fullstack topics alongside MongoDB on skillzunos.com