Courseiva

C100DBA · domain

CRUD Operations

The CRUD Operations domain covers creating, reading, updating, and deleting documents in MongoDB using the shell and drivers. Questions test specific method names and update operators, plus the exact return values of read and write operations. You must know which operator or method fits a described task, and what MongoDB returns when a query matches nothing.

33 questions8 easy20 medium5 hard

Focused practice

Practice CRUD Operations questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about CRUD Operations

Be able to map a described data change to the exact MongoDB update operator or method, and to state what each read and write returns. The most important thing to get right is choosing $inc, $set, $push, $pull, $pop, updateMany with upsert, or findOne correctly for the scenario given.

Selecting the correct update operator such as $inc, $set, $push, or $pull for a described field change.

Using updateOne, updateMany, and replaceOne, and knowing how upsert inserts when no document matches.

Return values of findOne and find, including null when no document matches the query.

Removing array elements with $pull versus $pop, and inserting with $push and $addToSet.

Watch out for

Common CRUD Operations exam traps

  • ▸Confusing $pull, which removes array elements by value or condition, with $pop, which removes the first or last element only.
  • ▸Assuming findOne returns an empty document or throws an error when nothing matches; it actually returns null.
  • ▸Forgetting that updateMany without upsert true modifies only existing matches and inserts nothing when none are found.

Question index

All CRUD Operations questions (33)

Click any question to see the full explanation, or start a practice session above.

1

Refer to the exhibit. What is the effect of the 'writeConcern' parameter in this operation?

Medium
2

What happens if you run an update operation with the $set operator on a field that does not yet exist in the document?

Medium
3

A retail application stores product documents in the `products` collection. Each document has an `inventory` array of embedded subdocuments, for example: `{ _id: 1, name: "Widget", inventory: [ { sku: "A1", qty: 5 }, { sku: "B2", qty: 8 } ] }`. The warehouse team needs to increase the `qty` of the subdocument with `sku: "B2"` by 3 for the product with `_id: 1`. Which update operation accomplishes this?

Medium
4

A developer needs to insert a document into the inventory collection and wants the operation to fail with a duplicate key error if a document with the same value for the sku field already exists. The sku field has a unique index. Which insert method and option combination achieves this with the least code?

Easy
5

Which operator is best used to add an element to an array only if it does not already exist?

Medium
6

A DBA is reviewing update operations that use the upsert option. Which TWO statements about upsert behavior in MongoDB are correct? (Choose two.)

Medium
7

A collection called events stores documents with an array field named tags. You need to remove all occurrences of the string "obsolete" from the tags array in every document where the array contains that value, without affecting other elements. Which update operator should you use?

Medium
8

When using the find() method, which cursor modifier is used to skip a specific number of documents before returning results?

Easy
9

What happens when you perform a find() query on a collection where the projection includes both an inclusion and an exclusion for different fields?

Hard
10

You are updating a document in the `products` collection. The document has an array field `tags`. You need to add the tag "sale" to the array only if it does not already exist, and you want to ensure that no duplicate tags are added even if multiple updates run concurrently. Which update operator should you use?

Medium
11

Refer to the exhibit. What is the impact of this operation on the document?

Hard
12

A DBA is reviewing a slow query on the `orders` collection. The query is: `db.orders.find( { status: "shipped", total: { $gt: 100 } } )`. The collection has an index on `{ status: 1, total: 1 }`. Which statement best describes how MongoDB will use this index to satisfy the query?

Easy
13

You are maintaining an inventory collection where each document has a field named `stock` (integer). A nightly job needs to atomically decrement `stock` by 1 for the document with `sku: "A100"` and also insert the current timestamp into a `lastUpdated` field in the same operation, without overwriting any other fields. Which update operation should you use?

Medium
14

Which method is the safest way to delete a single document from a collection based on a unique identifier?

Easy
15

Which THREE of the following are valid MongoDB CRUD query operators?

Hard
16

Which method is the most efficient way to perform a bulk update of multiple documents in a single request?

Medium
17

A developer needs to retrieve a subset of fields from a collection. Which TWO methods achieve this using projection?

Medium
18

What is the result of applying a $push operator with a value of [1, 2] to an existing array field [0]?

Medium
19

You are a MongoDB DBA at a retail company. The 'orders' collection has a document with _id: 100 and status: 'pending'. You need to atomically update the status to 'shipped' only if the current status is 'pending'. Which update operation should you use?

Medium
20

Refer to the exhibit. Which documents will this query return?

Medium
21

You are a MongoDB DBA and need to retrieve all documents from the 'products' collection where the 'price' field is greater than 100 and the 'category' is 'electronics'. Which query accomplishes this?

Easy
22

Which query operator matches documents where a field contains a value greater than or equal to a specified value?

Medium
23

Which operator is used to perform a logical OR operation across multiple query conditions?

Medium
24

What is the primary function of the 'projection' parameter in the find() method?

Easy
25

A sharded cluster stores customer documents in the customers collection, sharded on the customerId field. An application runs an updateOne with the filter { email: "user@example.com" } and the update { $set: { tier: "gold" } }. The email field is not the shard key and has no index. What is the most likely outcome of this operation?

Hard
26

A DBA is investigating a performance issue. A query on the `logs` collection uses the following filter: `{ $or: [ { level: "error" }, { level: "warning" } ] }`. There is an index on `{ level: 1 }`. Which statement correctly describes how MongoDB executes this query?

Hard
27

Which cursor method should you use to sort documents by a field named 'age' in descending order?

Medium
28

A MongoDB 6.0 replica set has a collection called orders with the default read concern. Users occasionally see an order document that still shows status "pending" even though a separate application thread just updated it to "shipped" and received an acknowledgment. The update used default write concern and targeted a single document by _id. Which read concern should you set on the read operation to guarantee the read returns data acknowledged by a majority of replica set members?

Medium
29

Which update operator would you use to increase the value of a numeric field by a specific amount?

Medium
30

You need to remove a single document from the `users` collection where the `email` field is "alice@example.com". The collection has a unique index on `email`. Which method should you use?

Easy
31

Which method should you use to update multiple documents in a collection and insert a new document if no matches are found?

Medium
32

When performing a findOne operation, what does MongoDB return if no document matches the query criteria?

Easy
33

Which operator would you use to remove an element from an array field in a document?

Medium

Frequently asked questions

What does the CRUD Operations domain cover on the C100DBA exam?
Be able to map a described data change to the exact MongoDB update operator or method, and to state what each read and write returns. The most important thing to get right is choosing $inc, $set, $push, $pull, $pop, updateMany with upsert, or findOne correctly for the scenario given.
How many questions are in this domain?
This page lists all 33 CRUD Operations questions in the C100DBA question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only CRUD Operations questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
mongodb-dba-associate MONGODB-DBA-ASSOCIATE crud operations Practice Questions