Try 12 MongoDB Associate Developer sample questions on document modeling, CRUD operations, indexes, aggregation pipelines, transactions, drivers, and application data-access decisions.
MongoDB Associate Developer is a developer route for candidates who use MongoDB from application code, write queries and updates, design document access patterns, use indexes, and reason through aggregation or transaction behavior.
Use this page to preview the kind of developer decisions a MongoDB practice route should test. The questions below are original IT Mastery sample questions, not official MongoDB exam questions.
Topic: document shape
An application always displays an order with its line items, and line items are rarely queried independently. Which model is usually best?
Best answer: B
Explanation: Embedding fits data that is read together and has a bounded size. It avoids extra lookups for the common order view while keeping the document aligned with the application’s access pattern.
Topic: indexes
A query filters on { status: "open", customerId: ... } and sorts by createdAt. What should the developer consider?
Best answer: C
Explanation: Compound indexes can support filters and sort operations when ordered to match the query pattern. The exact index order depends on selectivity and the workload, but a generic text index is not the answer.
Topic: update operators
Which update is safest when incrementing a numeric loginCount field?
$incBest answer: A
Explanation: $inc performs an atomic increment on the field. Replacing the whole document can lose concurrent updates if not carefully controlled.
Topic: aggregation
A report needs total revenue by month for completed orders. Which feature is most relevant?
Best answer: D
Explanation: Aggregation pipelines transform and summarize documents. Filtering completed orders, grouping by month, and summing revenue directly matches the report requirement.
Topic: projections
Why should a query use projection when the application needs only three fields from large documents?
Best answer: B
Explanation: Projection controls which fields are returned. It can reduce network transfer and application processing, especially when documents contain large fields not needed by the view.
Topic: transactions
When might a multi-document transaction be justified?
Best answer: C
Explanation: Transactions support atomicity across multiple documents or collections when required. They are not a substitute for good modeling and should not be used unnecessarily for simple single-document operations.
Topic: drivers
What should application code do with database connection handling?
Best answer: A
Explanation: Drivers are designed with connection management patterns such as pooling. Applications should follow driver and framework guidance instead of repeatedly opening connections or embedding secrets.
Topic: query troubleshooting
A query is unexpectedly slow. What should be reviewed first?
Best answer: D
Explanation: Query performance depends on filters, indexes, cardinality, sorting, projection, and execution path. Developers should use evidence before changing the model or adding broad indexes.
Topic: schema validation
Why might a team use schema validation in MongoDB?
Best answer: B
Explanation: Schema validation can enforce required fields, types, or constraints where consistency matters. It does not eliminate the need for application validation and testing.
Topic: read preference
What is a key risk of reading from secondaries in a replica set?
Best answer: C
Explanation: Secondary reads can improve read scaling or locality, but they may not reflect the latest primary writes. Developers must understand consistency requirements.
Topic: error handling
A write fails with a duplicate key error. What does that usually indicate?
Best answer: A
Explanation: Duplicate key errors commonly occur when an insert or update violates a unique index. The application should handle the conflict according to business rules.
Topic: data modeling
A product document has a growing unbounded array of user activity events. What is the likely modeling concern?
Best answer: D
Explanation: Embedding is useful for bounded, related data. Unbounded event history can create large documents and update hot spots, so a separate collection or bucketing pattern may be better.
| If you miss… | Drill this next |
|---|---|
| modeling questions | embedding, references, bounded arrays, and access patterns |
| query questions | indexes, projection, sort support, and execution evidence |
| application questions | driver lifecycle, transactions, consistency, and error handling |
Use this page to preview question style and confirm the route. If you want MongoDB Associate Developer practice updates, use the Notify me form above.