nerdexam
MongoDB

C100DBA · Question #69

Below is a sample document of "orders" collection

The correct answer is A. $project. $project is correct because it is the MongoDB aggregation pipeline stage used to reshape documents - allowing you to include, exclude, rename, or compute new fields from source documents like those in an "orders" collection. It acts as a field selector and transformer, giving you

MongoDB Fundamentals

Question

Below is a sample document of "orders" collection

Exhibit

C100DBA question #69 exhibit

Options

  • A$project

How the community answered

(36 responses)
  • A
    100% (36)

Explanation

$project is correct because it is the MongoDB aggregation pipeline stage used to reshape documents - allowing you to include, exclude, rename, or compute new fields from source documents like those in an "orders" collection. It acts as a field selector and transformer, giving you precise control over what appears in the output documents.

Without seeing the other choices, I can speak to common distractors in this category: $match is wrong if selected because it filters documents by condition rather than reshaping them; $group is wrong because it aggregates documents together (e.g., summing totals), not selects fields; $sort is wrong because it only orders documents; and $unwind is wrong because it deconstructs array fields into separate documents.

Memory tip: Think of $project like the SELECT clause in SQL - just as SELECT name, price FROM orders picks which columns appear, $project: { name: 1, price: 1 } picks which fields appear in your MongoDB pipeline output.

Topics

#aggregation pipeline#$project#field selection

Community Discussion

No community discussion yet for this question.

Full C100DBA Practice