Courseiva
Aggregation Framework →mediumMultiple Choice

C100DEV Aggregation Framework Practice Question

A support team stores tickets in a `tickets` collection where each document has a `status` field that may be missing on legacy records. A developer runs a pipeline whose first stage is { $match: { status: { $ne: "closed" } } } and expects every non-closed ticket to appear in the results. Which set of documents does this stage pass downstream?

⚠ Common exam trap

The trap here is expecting $ne to behave like a logical negation that also admits documents missing the field.

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

✓

Only documents where status exists and is not equal to "closed".

Comparison operators in an aggregation $match evaluate against existing field values. When a field is absent, a comparison to a string such as $ne "closed" cannot be satisfied, so those documents are filtered out. To retain them, the pipeline would need an explicit $or clause testing for field absence or null alongside the inequality.

Answer analysis

Option-by-option breakdown

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

  • ✗

    All documents, because $match only removes documents when a field is explicitly set to null.

    Why it's wrong here

    $match filters aggressively on any predicate that fails, not merely on explicit nulls. Treating missing fields as automatically passing is incorrect; a $ne comparison requires the field to exist with a value. The claim also confuses null handling with field absence, which are distinct cases in MongoDB query semantics.

  • ✓

    Only documents where status exists and is not equal to "closed".

    Why this is correct

    The $ne operator compares values, and a missing field is treated as not matching a comparison against a string. Documents lacking status therefore fail the predicate, so only documents where status is present and differs from "closed" survive. Legacy records with no status are silently excluded from the pipeline output.

  • ✗

    Documents where status exists and equals "closed", because $ne inverts the comparison during aggregation.

    Why it's wrong here

    $ne does not invert its predicate inside aggregation; it behaves the same as in find queries, matching values that differ from the operand. Claiming it selects closed tickets reverses the intended logic entirely. The result would be the opposite of the developer's goal and still exclude missing-field documents.

  • ✗

    Documents where status is not "closed", including documents where the field is absent.

    Why it's wrong here

    This misstates how $match treats missing fields. A comparison predicate against a string value does not match a document that lacks the field, so absent status records are dropped rather than included. The pipeline returns fewer documents than the developer anticipates, which is the source of the reported discrepancy.

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.