C100DBA practice question 18 of 25
Which of the following command inside aggregate command is used in MongoDB aggregation to filter the documents to pass only the documents that match the specified condition(s) to the next pipeline stage.
Full set: 130 questionsIn the MongoDB aggregation framework, the pipeline consists of stages. The $match stage is specifically designed to filter documents. It processes all documents in a collection and outputs only those that satisfy the specified query conditions. This stage is typically placed early in the pipeline to reduce the amount of data processed by subsequent stages, which improves performance. It uses standard MongoDB query syntax.
A. $aggregate is the command that initiates the aggregation pipeline; it is not a filtering stage within the pipeline itself.
B. $sum is an accumulator operator used within the $group stage to calculate a sum, not for filtering documents.
D. $group is a pipeline stage that groups input documents by a specified identifier expression and applies accumulator expressions to each group.
1. MongoDB Manual, Aggregation Pipeline Stages, $match. (https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/) "Filters the documents to pass only the documents that match the specified condition(s) to the next pipeline stage."
2. MongoDB University, M121: The MongoDB Aggregation Framework, Chapter 2: Basic Aggregation - $match and $project. "The $match stage provides a query mechanism to filter documents in an aggregation pipeline."
Keep practicing
Take the free C100DBA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other C100DBA practice questions
- Question 1If the value of totalKeysExamined is 30000 and the value of totalDocsExamined is 0, which…
- Question 2The oplog (operations log) is a special capped collection that keeps a rolling record of …
- Question 3‘$set' sets the value of
- Question 4What does the totalKeysExamined field returned by the explain method indicate?
- Question 5Which mongodb tools allow us to work with our data in a human readable format?
- Question 6Which of the following is incorrect statement about find and findOne operations in MongoD…
