nerdexam
MongoDB

C100DBA · Question #32

Below is a sample document of "orders" collection

The correct answer is A. $sort. The question appears to be incomplete - the full prompt text and distractor options (B, C, D) are missing, so a complete explanation comparing all choices isn't possible. That said, here's what can be explained based on what's provided: Why $sort is correct: In MongoDB…

MongoDB Fundamentals

Question

Below is a sample document of "orders" collection

Exhibit

C100DBA question #32 exhibit

Options

  • A$sort

How the community answered

(33 responses)
  • A
    100% (33)

Explanation

The question appears to be incomplete - the full prompt text and distractor options (B, C, D) are missing, so a complete explanation comparing all choices isn't possible.

That said, here's what can be explained based on what's provided:

Why $sort is correct: In MongoDB aggregation pipelines, $sort orders documents in the pipeline by one or more fields (e.g., { $sort: { orderDate: -1 } } to sort an orders collection by date descending). It's the appropriate stage when the task involves arranging results in a specific sequence.

No distractors were provided in this question, so the "why each is wrong" portion cannot be addressed.

Memory tip: Think of $sort as the pipeline's "organizer" - it doesn't filter or reshape documents, it just lines them up. If the task says arrange, rank, or order by, reach for $sort.


Could you share the complete question text and all answer choices? That way I can give you a full, accurate explanation comparing every option.

Topics

#aggregation#$sort#pipeline stages

Community Discussion

No community discussion yet for this question.

Full C100DBA Practice