Skip to main content
Databases & Storage

MongoDB & Document Database Architecture Quiz (2026)

15 Questions15 MinsPass: 80%

Test your mastery of MongoDB: Document modeling, Aggregation pipelines ($match, $group, $lookup), and compound indexes using the ESR rule.

Question 1 of 150% Completed
Single Choice

What is the ESR rule for optimizing compound indexes in MongoDB?

Select an option above

MongoDB: Assessment Scope & Sample Focus Areas

15 questions • 80% pass target

This interactive technical assessment checks your practical understanding of MongoDB (Databases & Storage) across syntax behavior, edge cases, and architectural decisions.

Topic 1 of 15

What is the ESR rule for optimizing compound indexes in MongoDB?

Topic 2 of 15

What is the primary architectural difference between embedding documents and referencing in MongoDB?

Topic 3 of 15

In the MongoDB Aggregation Pipeline, what does `$lookup` perform?

Topic 4 of 15

What does `writeConcern: { w: 'majority', j: true }` guarantee in MongoDB?

Topic 5 of 15

What is the maximum BSON document size in MongoDB?

Topic 6 of 15

What is an `ObjectId` in MongoDB comprised of?

Frequently Asked Questions

MongoDB Assessment: Key Technical Questions & Answers

5 Questions Answered
1What is the MongoDB WiredTiger storage engine and how does its Checkpoint and Journaling process work?
WiredTiger is MongoDB's default storage engine, offering document-level concurrency control and Snappy compression. WiredTiger writes modifications to in-memory cache and appends operations to an on-disk write-ahead Journal every 100ms (or on `j: true`). Every 60 seconds (or 2GB of journal data), WiredTiger writes a durable Checkpoint to disk, reconciling dirty cache pages with consistent on-disk data files to guarantee zero corruption after unexpected crashes.
2How does the MongoDB Aggregation Pipeline differ from standard `find()` queries?
`find()` queries are limited to filtering, projection, and sorting operations. The Aggregation Pipeline processes documents sequentially through multi-stage data transformation pipes: `$match` filters documents early, `$project` transforms shapes, `$group` aggregates metrics via accumulator expressions, `$unwind` decomposes array elements, and `$lookup` performs left-outer equality joins across disparate collections.
3What is the ESR (Equality, Sort, Range) rule for optimizing compound indexes in MongoDB?
The ESR rule dictates the exact optimal field ordering when creating compound indexes: 1. Equality fields first (keys tested for exact matches like `{ status: 'active' }`) to immediately narrow candidate index keys. 2. Sort fields second (keys used in `sort()`) allowing the engine to satisfy ordering directly from the B-tree index without memory-intensive in-memory sorting. 3. Range fields last (keys with `$gt`, `$lt`, `$in`) so remaining range scans are performed on the minimal subset.
4How does a MongoDB Replica Set elect a Primary node and handle failover?
MongoDB Replica Sets use a consensus election protocol inspired by Raft. Nodes send heartbeats every 2 seconds. If secondaries miss heartbeats from the Primary for 10 seconds, an election is triggered. Secondaries vote for candidates with the highest election priority and the freshest `oplog` (Operation Log) timestamp, electing a new Primary in under 3-5 seconds without human intervention.
5What is Sharding in MongoDB and how do Hashed vs Ranged Shard Keys distribute data?
Sharding partitions data horizontally across independent replica sets (shards) coordinated by `mongos` query routers and `configsvr` replica sets. Ranged Shard Keys partition documents based on value ranges, which optimizes range queries but risks hotspotting writes on the maximum range chunk. Hashed Shard Keys compute MD5 hashes of key values to scatter writes evenly across all shards, maximizing write throughput at the expense of broadcast range scans.

Next Steps for Mastery

Reinforce your knowledge with cheatsheets, interactive sandboxes, and interview prep.