MongoDB Study Guide 2026
Everything you need to pass the MongoDB exam in one place: the exam format, every topic to study, real practice questions with explanations, flashcards, and full-length practice tests. Free, no sign-up needed.
📋 MongoDB Exam Format at a Glance
📚 MongoDB Topics to Study (38)
✍️ Sample MongoDB Questions & Answers
1. What is the ESR rule for compound index design in MongoDB?
The ESR rule states that in a compound index, place Equality fields first, Sort fields second, and Range fields last for optimal query performance.
2. Which field is automatically created by MongoDB for every document if not explicitly provided?
MongoDB automatically creates an _id field for every document if one is not provided. By default, this is an ObjectId — a 12-byte BSON type that encodes a timestamp, machine identifier, process ID, and a random increment, ensuring global uniqueness.
3. What is the impact of using transactions on MongoDB performance?
Multi-document transactions in MongoDB introduce overhead: they hold locks, create larger oplog entries, and require coordination across members. MongoDB documentation recommends using the document model to avoid transactions where possible and to keep transactions short when they are necessary.
4. What is the correct way to sort query results in descending order by a field named 'score'?
Using -1 as the sort value specifies descending order, while 1 specifies ascending order.
5. What is the $addFields stage used for in aggregation?
$addFields outputs documents containing all existing fields plus any newly added or modified fields.
6. What is a write conflict in a MongoDB transaction?
A write conflict occurs when two concurrent transactions attempt to write to the same document. MongoDB detects this and aborts one of the conflicting transactions with a TransientTransactionError, expecting the application to retry the aborted transaction.