C100DEV Aggregation Framework Practice Question
A developer is building an aggregation pipeline on a collection of blog posts. Each post document contains an array field `comments`, where each comment is an object with `author` and `text`. The developer needs to produce a separate document for each comment, preserving the post's `title` and the comment's `author` and `text`. Which TWO stages are required to achieve this? (Choose two.)
⚠ Common exam trap
The trap here is thinking $group is needed to reorganize data, but it actually aggregates, not expands, documents.
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
To create a separate document for each comment, the pipeline must first use $unwind to deconstruct the comments array. Then, $project is used to shape the output documents, including the post title and the comment's author and text fields. Together, these stages achieve the required transformation.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
$sort
Why it's wrong here
$sort orders documents but does not help in deconstructing an array or reshaping documents. It might be used later for ordering the output, but it is not required for the core transformation. Therefore, $sort is not one of the required stages.
- ✓
$unwind
Why this is correct
$unwind deconstructs the comments array, outputting one document per array element. This is essential to create a separate document for each comment. Without it, the array remains embedded, and you cannot easily project individual comment fields as top-level fields. Thus, $unwind is required.
- ✗
$match
Why it's wrong here
$match filters documents based on conditions. While it could be used to filter posts before unwinding, it is not required to achieve the basic transformation of creating one document per comment. The requirement does not mention any filtering criteria, so $match is not necessary.
- ✗
$group
Why it's wrong here
$group is used to aggregate documents, not to deconstruct arrays or reshape individual documents. It would combine documents, which is the opposite of what is needed here. Since the goal is to expand the array into separate documents, $group is not required and would be incorrect.
- ✓
$project
Why this is correct
$project reshapes the documents after unwinding, allowing you to include the title and the now top-level comment fields (author and text) while excluding other fields. It is necessary to produce the final desired document shape with only the specified fields. Hence, $project is required.
About these practice questions
Courseiva writes every C100DEV question from scratch — 259 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.