C100DBA · Question #15
Which of the following aggregate commands in MongoDB uses a pipeline approach with the goals of improving the aggregation performance?
The correct answer is C. aggregate. aggregate (option C) is the MongoDB command that explicitly uses a pipeline approach - a sequence of stages (like $match, $group, $sort, $project) where each stage transforms the data and passes results to the next, enabling query optimization, index usage, and parallel…
Question
Which of the following aggregate commands in MongoDB uses a pipeline approach with the goals of improving the aggregation performance?
Options
- AmapReduce
- Bgroup
- Caggregate
- DAll of the above
How the community answered
(33 responses)- A3% (1)
- B3% (1)
- C94% (31)
Explanation
aggregate (option C) is the MongoDB command that explicitly uses a pipeline approach - a sequence of stages (like $match, $group, $sort, $project) where each stage transforms the data and passes results to the next, enabling query optimization, index usage, and parallel execution.
mapReduce (A) uses JavaScript functions for map and reduce phases, which are slower and largely deprecated in favor of the aggregation pipeline - it does not use a pipeline model. group (B) is a legacy MongoDB command that is also non-pipeline and has been superseded by $group within the aggregate pipeline; it's not a top-level pipeline command itself.
Memory tip: Think of aggregate as an assembly line - each pipeline stage is a worker that processes and passes the product forward, making the whole process efficient. If you see "pipeline" on the exam, the answer is always aggregate.
Topics
Community Discussion
No community discussion yet for this question.