Courseiva
CRUD Operations →easyMultiple Choice

C100DBA CRUD Operations Practice Question

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

⚠ Common exam trap

Test-takers frequently confuse deleteOne with remove methods or assume drop() safely targets a single specific document using a unique identifier filter.

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.collection.deleteOne(filter)

The deleteOne method is the safest way to remove a single document because it accepts a filter and stops after deleting the first matching document, even if multiple documents match. This prevents accidental data loss that could occur with deleteMany if the filter criteria were not sufficiently specific. It is a fundamental practice to use the most restrictive method possible for destructive operations.

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.collection.remove(filter)

    Why it's wrong here

    The remove() method is deprecated and can delete multiple documents by default depending on the parameters provided. It is considered legacy syntax, and modern MongoDB standards dictate the use of deleteOne or deleteMany, which provide more explicit control and safer behavior for data deletion operations.

  • ✓

    db.collection.deleteOne(filter)

    Why this is correct

    deleteOne is the current standard method for deleting exactly one document. By ensuring that only the first matching document is removed, it minimizes the risk of accidental bulk deletions, which is a critical safety feature when working with production data where mistakes could be irreversible.

  • ✗

    db.collection.deleteMany(filter)

    Why it's wrong here

    deleteMany is designed to remove all documents matching the filter. Using it for a single document deletion is dangerous, as a loose filter could accidentally remove many documents. It should only be used when the explicit intention is to clear all records matching the provided criteria.

  • ✗

    db.collection.drop()

    Why it's wrong here

    The drop() method removes the entire collection, including all documents and indexes. This is an extremely destructive command that is not intended for deleting individual documents. Using it would result in the permanent loss of all data in the collection, which is far beyond the requirement.

About these practice questions

One of 222 original C100DBA 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 C100DBA 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 C100DBA exam.