← All MongoDB Flashcard Decks

Mixed Deck — All MongoDB Topics Flashcards

100 cards from real MongoDB practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 20 Mixed Deck — All MongoDB Topics flashcards as text
  1. What is the ESR rule for compound index design in MongoDB?

    Answer: Equality, Sort, Range — order fields in this sequence

    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?

    Answer: _id

    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?

    Answer: Transactions introduce overhead from lock management and oplog entries, reducing throughput compared to non-transactional operations

    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'?

    Answer: find().sort({ score: -1 })

    Using -1 as the sort value specifies descending order, while 1 specifies ascending order.

  5. What is the $addFields stage used for in aggregation?

    Answer: Adds new fields to documents without removing existing ones

    $addFields outputs documents containing all existing fields plus any newly added or modified fields.

  6. What is a write conflict in a MongoDB transaction?

    Answer: When two concurrent transactions attempt to modify the same document simultaneously

    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.

  7. What is the purpose of Atlas Database Users vs Atlas Organization Users?

    Answer: Database Users authenticate to MongoDB clusters; Organization Users manage Atlas infrastructure via the web UI and API

    Atlas distinguishes between Database Users (MongoDB credentials used by applications to connect and authenticate to clusters, defined with roles like readWrite or atlasAdmin) and Atlas Users (human users or API keys that manage Atlas infrastructure via the Atlas web UI, CLI, or API).

  8. What happens to a MongoDB transaction if commitTransaction() is not called before the session times out?

    Answer: The transaction is rolled back and all changes are discarded

    If a transaction is not committed before the session or transaction timeout (default 60 seconds), MongoDB automatically aborts and rolls back the transaction. All write operations within the transaction are discarded as if they never occurred.

  9. What is the embedded document (denormalized) data model in MongoDB?

    Answer: Storing related data as nested subdocuments within a single document

    Embedding stores related data in a single document as nested subdocuments, improving read performance by avoiding joins but potentially increasing document size.

  10. What is MongoDB's Ops Manager used for?

    Answer: On-premises deployment management, monitoring, backup, and automation for MongoDB

    MongoDB Ops Manager is an on-premises management platform for deploying, monitoring, backing up, and automating MongoDB clusters in private infrastructure.

  11. Which aggregation stage performs a left outer join to another collection?

    Answer: $lookup

    $lookup performs a left outer join with another collection in the same database, adding matched documents as an array field.

  12. What does the $count stage return in an aggregation pipeline?

    Answer: A single document with the count of documents passed to it

    $count outputs a single document containing a field with the count of documents that entered the stage.

  13. In MongoDB, single-document operations are atomic by default. What does this mean?

    Answer: An update to a single document either fully succeeds or fully fails — partial updates never occur

    MongoDB guarantees atomicity at the single-document level without needing transactions. An operation modifying a single document (including updating multiple fields or embedded arrays) either applies all changes or none — observers never see a partial update.

  14. Which built-in MongoDB role provides full administrative access to all databases?

    Answer: root

    The root role provides all privileges on all resources, giving unrestricted access to the entire MongoDB deployment.

  15. What does rs.status() return in the MongoDB shell?

    Answer: The current status of all replica set members including health, state, and replication lag

    rs.status() returns detailed information about each replica set member, including its state (PRIMARY, SECONDARY, ARBITER), health, uptime, last heartbeat time, and optionally replication lag (optimeDate difference from primary). It is the primary diagnostic command for replica sets.

  16. What is MongoDB's Encrypted Storage Engine used for?

    Answer: Encrypting data files at rest using AES-256 encryption

    MongoDB Enterprise's encrypted storage engine encrypts all data files at rest using AES-256, protecting data if physical storage is compromised.

  17. What does the $pull operator do in MongoDB update operations?

    Answer: Removes all array elements matching a condition

    $pull removes from an array all elements that match a specified condition or value.

  18. What does Atlas Global Clusters enable?

    Answer: Zone-based data distribution across geographic regions for low-latency local reads and data sovereignty compliance

    Atlas Global Clusters use MongoDB's zone sharding to distribute data across geographic regions. You define location-based zones so data is stored close to users for low-latency reads, and to comply with data residency regulations requiring data to remain in specific regions.

  19. What is document validation in MongoDB?

    Answer: Enforcing schema rules on insert and update operations using validation expressions

    MongoDB's document validation uses JSON Schema or query expressions to enforce rules on documents during insert and update operations.

  20. Which of the following is a recommended characteristic of a good shard key?

    Answer: High cardinality and even distribution of values to prevent hot spots

    A good shard key should have high cardinality (many distinct values), even distribution (values spread evenly across the data set), and query isolation (frequently queried with the shard key to enable targeted queries). High cardinality prevents jumbo chunks and ensures even chunk distribution.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy

Sources & references

Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy

  1. 10geneducation.zendesk.com — Test dates, score release, passing score, test delivery, retake policy · verified Oct 2026
  2. learn.mongodb.com — Eligibility, fees, exam format, time limit · verified Oct 2026