Courseiva
Aggregation Framework →easyMultiple Choice

C100DEV Aggregation Framework Practice Question

An analyst needs a pipeline that reads from a `sales` collection and, for each document, emits one output document per entry in the `regions` array, copying all other fields unchanged. Which stage accomplishes this?

⚠ Common exam trap

Watch out — candidates often confuse a stage that changes document shape, such as a projection, with one that changes document count, such as $unwind.

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

✓

{ $unwind: "$regions" }

Expanding an array into individual documents is the job of $unwind, which emits one document per element and replicates the non-array fields. It requires an array path; other stages either reduce document count, replace the whole document, or merely reshape fields without altering cardinality.

Answer analysis

Option-by-option breakdown

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

  • ✓

    { $unwind: "$regions" }

    Why this is correct

    $unwind deconstructs an array field so that the stage outputs one document per array element, duplicating the remaining fields for each. Pointing it at the regions path produces exactly one document per region while preserving every other field, which matches the requirement without additional stages.

  • ✗

    { $group: { _id: "$regions" } }

    Why it's wrong here

    Grouping collapses documents into one per distinct key and discards the other fields unless accumulators rebuild them. It reduces cardinality rather than expanding arrays into separate documents, so it moves in the opposite direction from the requested one-to-many transformation and loses the original field data.

  • ✗

    { $project: { regions: 1 } }

    Why it's wrong here

    A projection only includes or excludes fields on each document; it never changes the number of documents flowing through the pipeline. Restricting output to the regions field would keep the array intact and drop everything else, producing neither the one-document-per-element shape nor the preserved sibling fields.

  • ✗

    { $replaceRoot: { newRoot: "$regions" } }

    Why it's wrong here

    $replaceRoot promotes a specified embedded document to become the new top-level document. Since regions is an array rather than an object, this stage errors, and even with an object it would replace every other field instead of duplicating the document once per element. It does not perform array deconstruction.

About these practice questions

This C100DEV question is part of Courseiva's 259-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.