MongoDB Associate Developer Exam — Questions and Answers
Question 1: Which update operator sets the value of a field in a document?
- $inc
- $push
- $set (Correct answer)
- $unset
Correct answer: $set
$set assigns a new value to the specified field, creating it if it does not already exist.
Question 2: What read preference should be used to always read from the primary in MongoDB?
- primary (Correct answer)
- secondary
- primaryPreferred
- nearest
Correct answer: primary
The 'primary' read preference (the default) directs all read operations to the primary member, ensuring the most up-to-date data. It is the only read preference that guarantees reading the latest committed writes at the cost of increased primary load.
Question 3: What is a sparse index in MongoDB?
- An index on sparsely populated collections
- A partial index on every other document
- An index that only includes documents where the indexed field exists (Correct answer)
- An index with gaps between entries
Correct answer: An index that only includes documents where the indexed field exists
A sparse index only contains entries for documents that have the indexed field, skipping documents where the field is absent.
Question 4: What is the ESR rule for compound index design in MongoDB?
- Equality, Sort, Range — order fields in this sequence (Correct answer)
- Exact, Sparse, Range — use these index types together
- Efficient, Selective, Relevant — criteria for index creation
- Embedded, Scalar, Reference — document design patterns
Correct 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.
Question 5: What type of database is MongoDB?
- Column Based
- Graph Oriented
- Document Oriented (Correct answer)
- Key Value Pair
Correct answer: Document Oriented
Explanation: <br> MongoDB, for example, is a document-oriented database that may be used on a variety of systems. According to its classification, MongoDB is a NoSQL database application that employs JSON-like documents with optional schemas.
Question 6: What write concern { w: 'majority' } ensures in MongoDB?
- A majority of voting replica set members have acknowledged the write (Correct answer)
- All replica set members have written the data to disk
- Only the primary acknowledges the write
- The write is replicated to at least two members
Correct answer: A majority of voting replica set members have acknowledged the write
w: 'majority' means the write is acknowledged only after a majority of voting members have applied it, ensuring durability even if the primary fails.
Question 7: How do you start a multi-document transaction in MongoDB using the Node.js driver?
- client.openTransaction()
- db.collection.lockWrite()
- db.beginTransaction()
- session.startTransaction() (Correct answer)
Correct answer: session.startTransaction()
To use multi-document transactions in MongoDB, you first start a client session with client.startSession(), then call session.startTransaction(). All operations within the transaction must pass the session object, and you call session.commitTransaction() or session.abortTransaction() to finalize.
Question 8: Which MongoDB feature enforces that fields meet specific data type requirements?
- Type checking middleware
- Collection constraints
- Strict mode
- Schema validation with $jsonSchema (Correct answer)
Correct answer: Schema validation with $jsonSchema
$jsonSchema in collection validation rules allows specifying required fields, allowed types, value ranges, and other constraints enforced on write operations.
Question 9: What is the 'tree pattern' used for in MongoDB data modeling?
- Representing hierarchical data structures like org charts or category trees (Correct answer)
- Organizing collections in a tree hierarchy
- Creating B-tree index structures
- Storing filesystem-like data structures
Correct answer: Representing hierarchical data structures like org charts or category trees
The tree pattern represents hierarchical parent-child relationships, with various sub-patterns like parent references, child references, or materialized paths.
Question 10: What is a mongos in a MongoDB sharded cluster?
- The primary shard for system collections
- A monitoring service for shard health
- A query router that directs client requests to the appropriate shard(s) (Correct answer)
- A shard configuration backup service
Correct answer: A query router that directs client requests to the appropriate shard(s)
mongos is a routing service that acts as an interface between the client and the sharded cluster, directing queries and writes to the correct shard(s).
Question 11: Which method inserts multiple documents into a collection in a single operation?
- insertMany() (Correct answer)
- insertAll()
- insertBulk()
- bulkInsert()
Correct answer: insertMany()
insertMany() accepts an array of documents and inserts all of them in one call, returning acknowledgment with all inserted _ids.
Question 12: Which operator in $group keeps the first value of a field encountered per group?
- $min
- $head
- $first (Correct answer)
- $top
Correct answer: $first
$first returns the value of the field from the first document in each group as documents pass through the pipeline.
Question 13: What is the largest Index Key Limit and Number of Indexes per collection?
- 1024 bytes and 64 indexes (Correct answer)
- 64 bytes and 1024 indexes
- 1024 bytes and unlimited indexes
- 12 mega bytes and 64 indexes
Correct answer: 1024 bytes and 64 indexes
MongoDB imposes certain limits on indexes to ensure performance and manageability. An index key cannot exceed 1024 bytes in size, and a single collection is limited to a maximum of 64 indexes. These limits help prevent overly complex or inefficient indexing strategies that could degrade database performance and increase memory usage.
Question 14: What is the purpose of the 'priority' field in a replica set member configuration?
- Controlling the order of oplog application
- Assigning storage engine priority
- Influencing which member is most likely to be elected primary (Correct answer)
- Setting read preference weight for client connections
Correct answer: Influencing which member is most likely to be elected primary
The priority field (default 1) influences election outcomes. Members with higher priority are preferred as primary candidates. Setting priority to 0 prevents a member from becoming primary — useful for secondaries in remote data centers or dedicated reporting nodes.
Question 15: Which method removes a single document that matches the filter from a collection?
- deleteOne() (Correct answer)
- removeOne()
- dropOne()
- deleteFirst()
Correct answer: deleteOne()
deleteOne() deletes the first document that matches the filter, returning the count of deleted documents.
Question 16: Which of the following best describes a one-to-zillions relationship in MongoDB schema design?
- A self-referencing document structure
- A relationship where millions of child documents point to one parent, making embedding impractical (Correct answer)
- A many-to-many relationship handled by an intermediate collection
- A parent document with a small embedded array
Correct answer: A relationship where millions of child documents point to one parent, making embedding impractical
One-to-zillions describes relationships where the child side is unbounded and potentially enormous (e.g., log entries for a server). Embedding is impossible due to document size limits. Instead, each child document stores a reference to the parent — the reverse of typical embedding.
Question 17: What does the ErrorLabel 'UnknownTransactionCommitResult' indicate?
- The commit result is unknown due to network error; the application should retry the commitTransaction() call (Correct answer)
- The transaction committed successfully but the result could not be returned
- The transaction timed out before committing
- The transaction failed with a permanent error and must be retried from scratch
Correct answer: The commit result is unknown due to network error; the application should retry the commitTransaction() call
'UnknownTransactionCommitResult' means a network error occurred during the commitTransaction() call and it is unknown whether the commit succeeded. The application should retry only the commit (not the entire transaction) — MongoDB's commit is idempotent, so retrying is safe.
Question 18: What is Atlas Search in MongoDB Atlas?
- A Semrush-style SEO keyword search tool
- A full-text search engine built on Apache Lucene, integrated directly into Atlas clusters (Correct answer)
- A tool for searching Atlas documentation
- A keyword-based search across all Atlas organizations and projects
Correct answer: A full-text search engine built on Apache Lucene, integrated directly into Atlas clusters
Atlas Search is a fully managed full-text search solution built on Apache Lucene and integrated directly into Atlas clusters. It supports fuzzy matching, autocomplete, facets, custom analyzers, and relevance scoring — all using the MongoDB aggregation pipeline with the $search stage.
Question 19: Which method creates an index on a MongoDB collection?
- collection.createIndex() (Correct answer)
- collection.newIndex()
- collection.buildIndex()
- collection.addIndex()
Correct answer: collection.createIndex()
createIndex() creates an index on the specified field(s) with the given options, or returns the existing index name if it already exists.
Question 20: Which data modeling pattern is best suited when a one-to-many relationship has a bounded, small set of related items that are always read together?
- Reference pattern
- Bucket pattern
- Embedded document pattern (Correct answer)
- Polymorphic pattern
Correct answer: Embedded document pattern
The embedded document pattern is optimal for one-to-many relationships where the 'many' side is bounded and small. Embedding keeps related data co-located, enabling single-document retrieval and avoiding expensive joins or multiple queries.
Question 21: In MongoDB, what does schema validation using $jsonSchema allow you to enforce?
- Index creation on validated fields only
- Required fields, field types, value ranges, and custom validation rules at the database level (Correct answer)
- Only string field validation
- Automatic document versioning
Correct answer: Required fields, field types, value ranges, and custom validation rules at the database level
MongoDB's $jsonSchema validator enforces document structure at the database level. You can specify required fields, BSON types for fields, minimum/maximum values, string patterns, and more. Validation can be set to 'error' (reject invalid docs) or 'warn' mode.
Question 22: What are the three main components of a MongoDB sharded cluster?
- Balancer, indexer, and data node
- Primary, secondary, arbiter
- Mongos, config servers, and shards (Correct answer)
- Router, coordinator, and replica
Correct answer: Mongos, config servers, and shards
A MongoDB sharded cluster consists of: (1) mongos — the query router that clients connect to; (2) config servers — store cluster metadata and chunk distribution; and (3) shards — each shard is a replica set holding a subset of the sharded data.
Question 23: ______ is the mongo shell command that lists database names.
- show dbs (Correct answer)
- show db
- show database
- none of the above
Correct answer: show dbs
The `show dbs` command is a standard utility in the MongoDB shell used to display a list of all available databases on the current MongoDB instance. It provides a quick overview of the databases present, along with their respective sizes. This command is essential for navigating and managing different databases within the shell environment.
Question 24: Why is it an anti-pattern to use MongoDB transactions for every write operation?
- Transactions prevent secondary reads from being consistent
- Transactions require a dedicated config server
- Transactions are not supported on standalone mongod instances
- Transactions introduce latency overhead; MongoDB's document model allows many multi-entity operations to be atomic via embedding, eliminating the need for transactions (Correct answer)
Correct answer: Transactions introduce latency overhead; MongoDB's document model allows many multi-entity operations to be atomic via embedding, eliminating the need for transactions
MongoDB's document model encourages embedding related data so that operations affecting multiple 'entities' can be done in a single atomic document write. Transactions add significant overhead (locking, oplog growth, coordination). The best practice is to model data to avoid transactions and only use them when truly necessary.
Question 25: Which index type allows full-text search queries on string content?
- Wildcard index
- Hashed index
- Text index (Correct answer)
- Regex index
Correct answer: Text index
A text index tokenizes and stems string fields to support $text search queries, with at most one text index per collection.
Question 26: What does the $and operator do in a MongoDB query?
- Combines results from two collections
- Returns documents matching any one condition
- Returns documents where all conditions are true (Correct answer)
- Negates all conditions in the query
Correct answer: Returns documents where all conditions are true
$and performs a logical AND, returning only documents where all specified conditions are true.
Question 27: In which MongoDB version were multi-document ACID transactions introduced for replica sets?
- MongoDB 4.0 (Correct answer)
- MongoDB 4.2
- MongoDB 3.6
- MongoDB 5.0
Correct answer: MongoDB 4.0
Multi-document ACID transactions for replica sets were introduced in MongoDB 4.0. MongoDB 4.2 extended transactions to sharded clusters. Prior to 4.0, atomicity was guaranteed only at the single-document level.
Question 28: Which Atlas feature provides real-time performance metrics and allows you to kill long-running operations?
- Atlas Data Explorer
- Real-Time Performance Panel (Correct answer)
- Atlas Charts
- Performance Advisor
Correct answer: Real-Time Performance Panel
The Atlas Real-Time Performance Panel displays live metrics including operations per second, network throughput, connections, CPU usage, and a list of currently executing operations. DBAs can identify and terminate problematic long-running queries or slow operations directly from the panel.
Question 29: What is the default index created automatically on every MongoDB collection?
- A sparse index on null fields
- A unique index on the _id field (Correct answer)
- A text index on the name field
- A compound index on all fields
Correct answer: A unique index on the _id field
MongoDB automatically creates a unique index on the _id field for every collection, which cannot be dropped.
Question 30: What is the primary trade-off when using the Subset Pattern in MongoDB schema design?
- Better aggregations at the cost of larger documents
- Faster writes at the cost of slower indexes
- Improved sharding at the cost of schema flexibility
- Reduced document size at the cost of requiring more queries for complete data (Correct answer)
Correct answer: Reduced document size at the cost of requiring more queries for complete data
The Subset Pattern splits a document into a 'hot' subset (frequently accessed fields in the main document) and a 'cold' subset (rarely accessed fields in a separate document). This reduces working set size but requires an additional query to access full data.
Question 31: What is a covered query in MongoDB?
- A query that can be satisfied entirely using an index without accessing documents (Correct answer)
- A query protected by access control
- A query that covers all documents in a collection
- A query with full-text search coverage
Correct answer: A query that can be satisfied entirely using an index without accessing documents
A covered query is fulfilled entirely by the index, meaning MongoDB never needs to read actual documents, resulting in very high performance.
Question 32: Which type of index supports efficient queries on fields within embedded arrays?
- Multikey index (Correct answer)
- Sparse index
- Text index
- Hashed index
Correct answer: Multikey index
MongoDB automatically creates a multikey index when an indexed field contains array values, creating index entries for each array element.
Question 33: In MongoDB, a collection and a document are identical to which of the SQL concepts?
- Database and Table
- Table and Row (Correct answer)
- Table and Column
- Column and Row
Correct answer: Table and Row
In the context of relational databases (SQL), a table is a structured set of data, similar to how a collection in MongoDB holds a group of related documents. A row in a SQL table represents a single record, which directly corresponds to a document in MongoDB, as each document is a self-contained unit of data. This analogy helps bridge the understanding between SQL and NoSQL concepts.
Question 34: What operator is used to match documents where a field value is NOT equal to a specified value?
- $not
- $ne (Correct answer)
- $nin
- $neq
Correct answer: $ne
$ne (not equal) selects documents where the field value is not equal to the specified value, including documents without that field.
Question 35: What does the $count stage return in an aggregation pipeline?
- A running total of documents
- A single document with the count of documents passed to it (Correct answer)
- The count per group
- An array of all document IDs
Correct 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.
Question 36: What is a scatter-gather query in MongoDB sharding?
- A query that gathers statistics from all shards
- A MapReduce operation across shards
- A query without the shard key that must be sent to all shards and results merged (Correct answer)
- A query that collects data from multiple time periods
Correct answer: A query without the shard key that must be sent to all shards and results merged
Scatter-gather queries are broadcast to all shards because they lack the shard key; results are gathered and merged by mongos, making them less efficient.
Question 37: What does the $push operator do in MongoDB?
- Creates a new index
- Pushes a document to a new collection
- Removes an element from an array
- Appends a value to an array field (Correct answer)
Correct answer: Appends a value to an array field
$push appends a specified value to an array field, creating the array if it does not exist.
Question 38: Which operator is used to match documents where an array field contains all of the specified elements?
- $size
- $all (Correct answer)
- $in
- $elemMatch
Correct answer: $all
$all matches arrays that contain every element in the specified list, regardless of order.
Question 39: What is the purpose of readConcern 'linearizable' in MongoDB?
- Reads are guaranteed to reflect all writes acknowledged by any member
- Reads are served from the nearest member regardless of consistency
- Reads reflect the majority-committed state at the start of the read operation (Correct answer)
- Reads return data that may include uncommitted writes
Correct answer: Reads reflect the majority-committed state at the start of the read operation
readConcern 'linearizable' ensures that read operations reflect all successful majority-acknowledged writes that completed before the read began. It provides the strongest consistency guarantee but requires confirmation from a majority, making it slower than other read concerns.
Question 40: Which aggregation accumulator returns the sum of numeric values in a group?
- $add
- $sum (Correct answer)
- $total
- $count
Correct answer: $sum
$sum returns the sum of all numeric values, and when used as $sum: 1, it counts the number of documents in the group.
Question 41: What is the write concern { w: 'majority' } in MongoDB?
- Writes are replicated to all members before acknowledgment
- Writes are logged to disk but not replicated
- Writes are acknowledged after being written to a majority of voting replica set members (Correct answer)
- Writes are acknowledged after being written to the primary only
Correct answer: Writes are acknowledged after being written to a majority of voting replica set members
{ w: 'majority' } ensures MongoDB acknowledges a write only after it has been written to a majority of the replica set's voting members and is durable. This guarantees the write survives the failure of any single member, providing strong durability guarantees.
Question 42: What is the $addFields stage used for in aggregation?
- Adds a new collection field
- Adds computed index fields
- Adds new fields to documents without removing existing ones (Correct answer)
- Inserts fields from another collection
Correct answer: Adds new fields to documents without removing existing ones
$addFields outputs documents containing all existing fields plus any newly added or modified fields.
Question 43: What does the $bucket stage do in an aggregation pipeline?
- Distributes documents across shards
- Creates histogram data for visualization
- Groups documents into defined ranges based on a specified expression (Correct answer)
- Stores documents in memory buckets for faster access
Correct answer: Groups documents into defined ranges based on a specified expression
$bucket categorizes incoming documents into groups (buckets) based on a specified expression and defined boundaries.
Question 44: What is index selectivity in MongoDB performance tuning?
- The ability to select which index to use manually
- How selectively indexes are created per collection
- The number of fields included in a compound index
- How effectively an index narrows down the candidate documents (Correct answer)
Correct answer: How effectively an index narrows down the candidate documents
Index selectivity measures how much an index reduces the number of documents that need to be examined, with higher selectivity meaning fewer documents examined.
Question 45: The mongoimport command is used to do the:
- import all the data from one collection to another
- import all the data from one database to another
- imports content from an Extended JSON, CSV, or TSV export created by mongoexport (Correct answer)
- import all the MongoDB data from one format to another
Correct answer: imports content from an Extended JSON, CSV, or TSV export created by mongoexport
The `mongoimport` utility is a command-line tool specifically designed to import data from various file formats into a MongoDB collection. It commonly handles Extended JSON, CSV (Comma Separated Values), and TSV (Tab Separated Values) files, making it ideal for loading data that was previously exported by `mongoexport` or generated by other systems. It facilitates bulk data loading into MongoDB.
Question 46: In MongoDB schema design, what is the 'extended reference pattern'?
- Using DBRef objects for all references
- Duplicating a subset of frequently accessed fields from the referenced document (Correct answer)
- Extending the _id field with additional metadata
- Creating bidirectional references between documents
Correct answer: Duplicating a subset of frequently accessed fields from the referenced document
The extended reference pattern stores the _id reference plus a few frequently accessed fields from the related document to reduce join-like operations.
Question 47: Which MongoDB feature allows you to perform read and write operations atomically within a single pipeline stage?
- $transaction
- findAndModify / findOneAndUpdate (Correct answer)
- $out
- $merge
Correct answer: findAndModify / findOneAndUpdate
findAndModify (and its driver equivalents findOneAndUpdate, findOneAndReplace, findOneAndDelete) atomically find and modify a single document without needing an explicit multi-document transaction. These are atomic at the single-document level and are preferred for simple atomic operations.
Question 48: What does a compound index in MongoDB index?
- Compressed and uncompressed versions of a field
- A single field with multiple data types
- Multiple fields within a single index (Correct answer)
- Multiple collections simultaneously
Correct answer: Multiple fields within a single index
A compound index includes references to multiple fields, supporting queries that filter or sort on those fields in the specified order.
Question 49: How do you apply a projection in a MongoDB find() query to return only specific fields?
- db.col.find({field: 1})
- db.col.find({filter}, {field: 1}) (Correct answer)
- db.col.project({field: 1}).find({filter})
- db.col.find({filter}, {field: true})
Correct answer: db.col.find({filter}, {field: 1})
Projections are passed as the second argument to find(), with fields set to 1 to include them.
Question 50: In MongoDB, what is the Bucket Pattern primarily used for?
- Grouping documents by geographic region
- Partitioning collections across shards
- Batching write operations
- Aggregating time-series or IoT data into fixed-size groups within a single document (Correct answer)
Correct answer: Aggregating time-series or IoT data into fixed-size groups within a single document
The Bucket Pattern groups a stream of data (e.g., IoT sensor readings or time-series events) into fixed-size or time-window documents. Each bucket document holds many measurements, reducing document count, improving index performance, and enabling efficient range queries.
Question 51: What is an Atlas cluster tier (M0, M10, M30, etc.)?
- A geographic region selection for the cluster
- A predefined configuration defining CPU, RAM, and storage resources for the cluster (Correct answer)
- A billing cycle option for Atlas usage
- A measure of the number of replica set members
Correct answer: A predefined configuration defining CPU, RAM, and storage resources for the cluster
Atlas cluster tiers define the underlying hardware configuration: M0 is the free tier with shared resources; paid tiers (M10, M20, M30, M40, etc.) offer dedicated resources with increasing CPU, RAM, and IOPS. The tier determines performance and cost.
Question 52: _____ is the default query document for find().
- {null}
- all of the above
- null
- [] (Correct answer)
Correct answer: []
In MongoDB, the `find()` method without arguments is used to retrieve all documents from a collection, which is internally equivalent to passing an empty query document `{}`. While `{}` is the standard BSON object for an empty query, the option `[]` might conceptually be chosen in some contexts to represent an absence of specific query criteria. However, it's crucial to note that `db.collection.find([])` is not valid syntax for retrieving all documents; the correct form is `db.collection.find({})`.
MongoDB Associate Developer Exam
The MongoDB Associate Developer Exam validates core MongoDB development skills including CRUD operations, indexing strategies, schema design, and application integration using MongoDB drivers. It is the primary entry-level certification for developers building applications with MongoDB.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds
These practice questions were written with AI tools. They are not real exam questions. 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
- 10geneducation.zendesk.com — Test dates, score release, passing score, test delivery, retake policy · verified Oct 2026
- learn.mongodb.com — Eligibility, fees, exam format, time limit · verified Oct 2026