Courseiva
CRUD Operations →easyMultiple Choice

C100DEV CRUD Operations Practice Question

A logistics application stores shipment records in the 'shipments' collection. A developer must delete all shipment documents whose 'status' field equals 'cancelled'. Which command correctly performs this operation?

⚠ Common exam trap

The trap here is assuming the legacy remove() method still works or that deleteOne() deletes all matches.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

db.shipments.deleteMany({ status: "cancelled" })

Deleting a subset of documents based on field equality requires deleteMany() with the filter, which removes all matches and reports deletedCount. deleteOne() would remove only one record, the deprecated remove() is unavailable on current servers, and drop() eliminates the entire collection rather than matching documents.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    db.shipments.deleteOne({ status: "cancelled" })

    Why it's wrong here

    deleteOne() removes only the first matching document, leaving all remaining cancelled shipments in place. Since the requirement is to clear every cancelled record, a single deletion would silently leave data behind. It is appropriate only when exactly one document should be removed, which is not the case here.

  • ✓

    db.shipments.deleteMany({ status: "cancelled" })

    Why this is correct

    deleteMany() removes every document matching the filter, so passing the equality filter { status: "cancelled" } deletes all cancelled shipments in one operation. It returns a result document with the deletedCount, confirming how many records were removed. This is the direct, idiomatic way to purge a subset of documents based on a field value.

  • ✗

    db.shipments.remove({ status: "cancelled" })

    Why it's wrong here

    The remove() method was deprecated in MongoDB 3.x and removed in the modern 5.0+ shell, so it would fail against current servers. Even where it existed, the supported replacement is deleteMany() with the same filter. In this scenario the command would not reliably execute, making it the wrong choice for a current deployment.

  • ✗

    db.shipments.drop({ status: "cancelled" })

    Why it's wrong here

    drop() removes an entire collection and its indexes; it does not accept a filter argument in the way implied. Passing a query document would not selectively delete cancelled shipments and would instead affect the whole collection if the call were valid. It is far too destructive for a targeted status-based purge.

About these practice questions

One of 259 original C100DEV practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official MongoDB exam blueprint

This C100DEV practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DEV exam.