MongoDB Associate Database Administrator Exam-style mock test
MongoDB Associate Database Administrator Practice Exams|Practice test
Full explanations
Exam format
Pass line 65%
33 USD One-time · lifetime access
Enroll →
Sample questions
Example1 · MongoDB Architecture, Documents, and CRUD
A developer at a B2B SaaS company stores tenant billing records in MongoDB and asks why the collection uses BSON rather than plain JSON on disk. Which characteristic of BSON best answers this?
✓BSON is a binary-encoded format that natively supports typed values such as dates, 64-bit integers, and binary data not available in plain JSON text
Correct. BSON is a binary serialization format that adds native types like Date, 64-bit integers, Decimal128, and binary data beyond what JSON text can express.
・BSON enforces that every document in a collection shares an identical field schema before a write is accepted
Incorrect. BSON does not enforce a shared schema; MongoDB collections are schema-flexible by default.
・BSON compresses all string fields using zlib so that stored documents always occupy less space than JSON
Incorrect. BSON does not automatically zlib-compress strings, and it can actually be larger than equivalent JSON due to length prefixes and type bytes.
・BSON stores documents only as UTF-8 text and relies on the driver to interpret numeric types
Incorrect. BSON is binary, not plain UTF-8 text, and it encodes numeric types explicitly rather than leaving interpretation to drivers.
Explanation
BSON extends JSON with a binary encoding and additional typed values, which is why MongoDB uses it for storage and network transfer.
Example2 · Indexes, Query Optimization, and Performance
A B2B SaaS billing service runs the query db.invoices.find({ accountId: "acct-88" }) hundreds of times per second, and this field is the most common filter across the application. There is currently no index beyond the default. Which action most directly improves this query's performance?
✓Create an ascending single-field index on the accountId field used by the filter
Correct. A single-field index on accountId lets MongoDB jump straight to the matching documents instead of scanning the whole collection, directly accelerating this equality filter.
・Increase the WiredTiger cache so the entire invoices collection fits in memory and stays resident
Incorrect. Enlarging the cache may reduce disk reads but the query still performs a full collection scan because no index supports the equality predicate on accountId.
・Add a hashed index on accountId so lookups are distributed across the key space evenly
Incorrect. A hashed index supports equality lookups but is intended for sharding key distribution, not range queries, and offers no advantage over a plain index here.
・Rewrite it as an aggregation pipeline that groups invoice documents by the accountId value
Incorrect. An aggregation pipeline that merely groups by accountId adds overhead and still scans every document without an index on the filtered field.
Explanation
Equality filters on a frequently queried field are the classic case for a single-field index, which turns a collection scan into an efficient index lookup.
Example3 · Replication and High Availability
At a B2B SaaS analytics company, the platform team is moving its single-node MongoDB tenant database onto a three-member replica set before the next billing cycle. During the design review, a junior engineer asks what the main benefit of the replica set is. Which statement best describes the primary purpose of a replica set?
・It automatically shards the tenant collection across the three members so each member stores only one third of the documents to spread write load
Incorrect. Sharding, not replication, distributes a collection's documents across nodes; replica set members each hold the full copy of the data.
✓It keeps redundant copies of the data on multiple members and promotes a secondary automatically when the primary becomes unavailable
Correct. A replica set maintains redundant data copies across members and performs automatic failover by electing a new primary when the current one is unreachable.
・It encrypts the tenant data differently on every member so a single compromised node cannot expose the full customer dataset at rest
Incorrect. Replica sets do not use per-node differing encryption as their purpose; encryption at rest is a separate storage-engine feature and all members hold the same data.
・It compresses the oplog on secondaries to reduce storage cost
Incorrect. Oplog compression is not the purpose of a replica set and does not describe its high-availability role.
Explanation
A replica set exists to provide data redundancy and high availability through full data copies on each member plus automatic failover.
Example4 · Sharding and Horizontal Scaling
A healthcare services firm shards its 'patient_visits' collection, which grows by millions of documents daily, with timestamps that steadily increase. The team chose the monotonically increasing 'visit_timestamp' as the shard key, and now one shard absorbs almost all new inserts. Which shard key choice would best spread the insert load across shards?
✓A hashed shard key on 'patient_id' so inserts are distributed uniformly
Correct. A hashed key on a high-cardinality field like 'patient_id' randomizes insert targets so writes spread evenly across all shards.
・A single-field range key on 'visit_timestamp' retained with a lower chunk size
Incorrect. Keeping the monotonically increasing timestamp key preserves the hot-shard problem regardless of chunk size, because new values always route to the same chunk.
・A range key on 'clinic_region' alone, since regions group related visits together
Incorrect. Low-cardinality 'clinic_region' creates few large chunks and jumbo chunks, so it cannot balance writes evenly across shards.
・A compound range key combining 'visit_timestamp' first and then 'patient_id'
Incorrect. Leading with the increasing timestamp still funnels all new inserts to the highest chunk before the secondary field matters, so the hotspot remains.
Explanation
Monotonically increasing shard keys create a single hot shard. A hashed key on a high-cardinality field distributes inserts evenly.
Example5 · Security, Backup, Restore, and Administration
At a healthcare services firm, a reporting analyst must read patient-visit collections in the 'clinical' database but must never modify any document. As the DBA, which approach grants exactly the access the analyst needs?
・Grant the analyst the built-in 'readWrite' role on the 'clinical' database and instruct the analyst's application team to avoid issuing update operations during business hours
Incorrect. The 'readWrite' role permits insert, update, and delete operations, so relying on the team to voluntarily avoid writes violates least privilege.
✓Grant the analyst the built-in 'read' role scoped to the 'clinical' database
Correct. The built-in 'read' role grants query access to a database's collections without any write privilege, matching the requirement exactly.
・Grant the analyst the built-in 'dbAdmin' role on the 'clinical' database so they can query collections and view index metadata as needed
Incorrect. The 'dbAdmin' role grants administrative actions such as index and statistics management but is not the correct role for read-only data access.
・Grant the analyst the built-in 'root' role and rely on auditing to detect any writes
Incorrect. The 'root' role is a superuser role granting full access, which is far broader than a read-only analyst requires.
Explanation
Least privilege means granting only the 'read' role scoped to the database the analyst needs, avoiding any write-capable or superuser roles.
Example6 · MongoDB Architecture, Documents, and CRUD
A healthcare services firm stores patient visit records in a MongoDB collection. A developer asks which rule governs the structure of each document being inserted. Which statement correctly describes how MongoDB stores these documents?
・Every document must conform to a fixed column schema declared ahead of time at the database level
Incorrect. MongoDB collections are schema-flexible and do not require a fixed column schema declared ahead of time.
✓Documents are stored as BSON, a binary serialization that supports rich types like dates and arrays
Correct. Documents are stored as BSON, a binary-encoded format that natively supports types such as dates, arrays, and embedded objects.
・Documents must be plain UTF-8 text and cannot contain nested fields or embedded arrays at all
Incorrect. Documents routinely contain nested fields and embedded arrays; they are not limited to flat UTF-8 text.
・Each document is saved as a comma-separated row mapped to predefined relational table columns
Incorrect. MongoDB does not store documents as relational rows mapped to predefined table columns.
Explanation
MongoDB persists documents in BSON, a binary form of JSON that extends supported types (dates, binary data, ObjectId) while allowing a flexible, non-tabular schema.
Example7 · MongoDB Architecture, Documents, and CRUD
The retail brand UrbanThread stores each product as a document in a 'products' collection. A developer asks what format MongoDB actually uses to serialize and store these documents on disk, as opposed to the JSON representation seen in the shell. What should the DBA explain?
✓Documents are persisted as BSON, a binary-encoded format that extends JSON with additional data types such as Date, ObjectId, and 32-bit and 64-bit integers.
Correct. MongoDB stores documents as BSON, a binary serialization that adds types like Date, ObjectId, and integer types that JSON lacks.
・Documents are persisted as plain UTF-8 JSON text files that MongoDB parses into memory on every read.
Incorrect. The shell shows JSON-like output, but on-disk storage is binary BSON, not plain JSON text.
・Documents are persisted as XML internally and converted to JSON on output.
Incorrect. MongoDB does not use XML as an internal storage format at all.
・Documents are persisted as CSV rows keyed by the _id field.
Incorrect. Documents are not stored as CSV rows; CSV is only an import/export option.
Explanation
BSON is the binary representation MongoDB uses for storage and transport, extending JSON with richer types.
Example8 · MongoDB Architecture, Documents, and CRUD
At UrbanThread a developer inserts a new customer document without specifying an _id field. The DBA is asked what MongoDB does regarding the primary key for that document. Which statement is accurate?
・MongoDB rejects the insert because every document must include an explicit _id value supplied by the client application.
Incorrect. Clients may supply _id, but it is not required; MongoDB supplies one when absent.
✓MongoDB automatically generates a unique ObjectId and assigns it to the _id field for the document.
Correct. When _id is omitted, MongoDB generates a unique ObjectId and stores it as the document's primary key.
・MongoDB leaves the _id field null until the first update.
Incorrect. The _id is populated at insert time, never left null awaiting an update.
・MongoDB copies the collection name into the _id field.
Incorrect. The collection name is never used as the _id value.
Explanation
Every document needs an _id; if the client omits it, the server auto-generates an ObjectId.
Example9 · MongoDB Architecture, Documents, and CRUD
A UrbanThread batch job needs to add 500 new order documents to the 'orders' collection in a single server round trip. Which operation should the DBA recommend for inserting multiple documents at once?
✓db.orders.insertMany() with an array of the 500 order documents passed as the first argument.
Correct. insertMany() accepts an array of documents and writes them in a single batched operation.
・db.orders.save() invoked repeatedly once per document inside a client-side loop until all 500 are written.
Incorrect. Looping a single-document call per document is inefficient and not the intended bulk-insert method.
・db.orders.updateOne() with upsert enabled.
Incorrect. updateOne with upsert modifies or inserts a single matched document, not a batch of 500.
・db.orders.find() with a projection.
Incorrect. find() reads documents and performs no insertion.
Explanation
insertMany() is the purpose-built method for inserting an array of documents efficiently.
Example10 · MongoDB Architecture, Documents, and CRUD
A DBA at a financial services firm is documenting the deployment for a new fraud-detection platform that uses a sharded cluster. Application servers never connect directly to the data-bearing nodes. Which component do the applications connect to in order to have their queries routed to the correct shards?
✓The mongos query router, which directs client operations to the appropriate shards
Correct. The mongos is the query router that application clients connect to; it uses cluster metadata to route operations to the proper shards.
・The config server replica set that stores cluster metadata and chunk ranges
Incorrect. Config servers store metadata and chunk ranges but applications do not send their queries to them directly.
・The mongod primary on each shard that owns the relevant partition of data
Incorrect. Shard primaries hold data, but clients in a sharded cluster connect through mongos rather than to each mongod directly.
・A dedicated mongod arbiter process that only participates in elections
Incorrect. An arbiter only votes in elections and holds no data, so it never routes application queries.
Explanation
In a sharded cluster, applications connect to mongos, which routes operations to the correct shards using metadata from the config servers.
Example11 · MongoDB Architecture, Documents, and CRUD
A DBA is reviewing a transactions collection where each document stores a precise monetary amount for regulatory reporting. The team wants to avoid floating-point rounding errors on account balances. Which BSON type is most appropriate for storing exact decimal currency values?
✓The 128-bit decimal type, which preserves exact decimal precision for monetary values
Correct. The Decimal128 type stores exact decimal values and is recommended for currency to avoid binary floating-point rounding.
・The double type, a 64-bit IEEE 754 binary floating-point number
Incorrect. The double type uses binary floating-point representation, which can introduce rounding errors for decimal currency amounts.
・The string type, storing the amount as formatted text characters
Incorrect. Storing amounts as strings prevents numeric comparison and arithmetic and is not the intended monetary type.
・The long type, a 64-bit signed integer without fractional digits
Incorrect. The long type holds only whole numbers, so it cannot represent fractional currency amounts without scaling tricks.
Explanation
Decimal128 is the BSON type designed for exact decimal arithmetic, making it the correct choice for monetary values.
Example12 · MongoDB Architecture, Documents, and CRUD
A DBA at a manufacturing distributor models each part in a 'components' collection. One field must hold a list of compatible machine codes, and another must hold a nested object with supplier contact details. Which statement about these BSON field values is accurate?
✓A single field can store an array of strings, and another field can store an embedded document, because BSON natively supports both arrays and nested documents as values
Correct. BSON supports arrays and embedded documents directly as field values, so both the list of codes and the supplier object can be stored natively.
・Arrays are permitted but embedded documents must be stored in a separate linked collection joined at read time
Incorrect. Embedded documents are a native BSON value type and do not require a separate linked collection.
・Both the array of codes and the supplier object must be serialized to a single JSON string before insertion
Incorrect. Serializing values to a JSON string would lose type fidelity and the ability to query sub-fields; BSON stores structured values natively.
・BSON forbids arrays as top-level field values in any document
Incorrect. Arrays are fully valid BSON field values, including at the top level of a document.
Explanation
BSON natively represents arrays and embedded documents as field values, which is central to MongoDB's document model.
Example13 · MongoDB Architecture, Documents, and CRUD
The distributor's import job inserts order documents into the 'orders' collection without specifying an _id value. What does MongoDB do regarding the _id field for each inserted order?
・It leaves _id empty until the application later issues an update operation that explicitly populates the field with a chosen key
Incorrect. MongoDB does not defer _id population to a later update; it assigns a value at insert time.
✓It automatically generates a unique ObjectId for _id if the field is absent, and this field is uniquely indexed by default
Correct. When _id is omitted, MongoDB generates an ObjectId automatically, and the _id field always has a unique index.
・It rejects every insert that omits _id and returns a validation error
Incorrect. Omitting _id is normal and accepted; MongoDB supplies a value rather than rejecting the insert.
・It copies the first field of the document into _id as the key
Incorrect. MongoDB generates a dedicated ObjectId; it does not reuse the first field as the key.
Explanation
Every document requires an _id; if not supplied, MongoDB generates an ObjectId, and _id is always uniquely indexed.
Example14 · MongoDB Architecture, Documents, and CRUD
A telecom operator is migrating subscriber records from a relational schema where each subscriber joins to address and plan tables. The data architect wants to leverage MongoDB's document model. Which design best reflects an idiomatic document model for this subscriber data?
✓Embed the related address and plan data inside each subscriber document so related fields are retrieved together
Correct. Embedding frequently accessed related data in one document lets a single read return the subscriber with address and plan, matching MongoDB's document model.
・Create one collection per table and always perform client-side lookups across the subscriber, address, and plan collections for every read
Incorrect. Forcing a separate collection per table and client-side joins on every read discards the main benefit of the document model and adds round trips.
・Store every subscriber attribute as an individual single-field document keyed only by the subscriber identifier value
Incorrect. Fragmenting each attribute into its own single-field document is an anti-pattern that produces many tiny documents and costly reassembly.
・Keep the normalized relational tables unchanged and rely on foreign-key joins enforced by the MongoDB server engine
Incorrect. MongoDB does not enforce foreign-key joins server-side, so keeping untouched normalized tables misrepresents how the engine works.
Explanation
The document model encourages embedding related data that is accessed together, so a subscriber document holding its address and plan fields is idiomatic and efficient.
Example15 · MongoDB Architecture, Documents, and CRUD
A telecom operator's billing team stores each invoice's issuedAt timestamp and totalCents amount in MongoDB documents. The developer wants the timestamp to sort chronologically and the amount to support exact integer arithmetic. Which BSON types should be used?
✓Store issuedAt as a Date and totalCents as a 64-bit integer (long) so both sort and compute correctly
Correct. The BSON Date type sorts chronologically and a long holds exact integer cents, matching both requirements.
・Store issuedAt as a formatted String and totalCents as a floating-point Double so the fields remain fully human-readable in every client
Incorrect. Strings do not sort as true dates across formats and Double introduces floating-point rounding unsuitable for exact currency math.
・Store issuedAt as a Timestamp internal type and totalCents as a Decimal128 to force the server to round both values automatically
Incorrect. The BSON Timestamp type is an internal replication construct, not a general date field, and Decimal128 does not force automatic rounding.
・Store issuedAt as an ObjectId and totalCents as a String to guarantee uniqueness across all billing documents in the cluster
Incorrect. ObjectId is for identifiers, not dates, and storing amounts as strings blocks numeric arithmetic and comparisons.
Explanation
BSON Date is the correct type for chronological timestamps and a long integer preserves exact cent values, avoiding the pitfalls of strings, doubles, or internal types.
▶ Try 10 free questions (graded)