MongoDB MCQ Questions - Aggregation

This section focuses on "Aggregation" in MongoDB. These Multiple Choice Questions (MCQ) should be practiced to improve the MongoDB skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. The basic syntax of Aggregation is?

A. db.COLLECTION_NAME.aggregate ({key:1})
B. db.COLLECTION_NAME.aggregation (AGGREGATE_OPERATION)
C. db.COLLECTION_NAME.aggregate (AGGREGATE_OPERATION)
D. aggregate (AGGREGATE_OPERATION)

View Answer


2. Which of th following expression is used to calculates the average of all given values from all documents in the collection?

A. $sum
B. $avg
C. $min
D. $max

View Answer


3. Which of th following expression is used to gets the maximum of the corresponding values from all documents in the collection?

A. $sum
B. $push
C. $min
D. $max

View Answer


4. Which of th following expression is used to Inserts the value to an array in the resulting document?

A. $addToSet
B. $first
C. $push
D. $last

View Answer


5. Which of th following expression is used to gets the first document from the source documents according to the grouping?

A. $addToSet
B. $first
C. $push
D. $last

View Answer


6. Which stages in aggregation framework Used to select some specific fields from a collection?

A. $project
B. $group
C. $limit 
D. $unwind 

View Answer


7. What is true about $unwind stages in aggregation framework ?

A. It is used to unwind document that are using arrays.
B. When using an array, the data is kind of pre-joined and this operation will be undone with this to have individual documents again. 
C. This stage we will increase the amount of documents for the next stage.
D. All of the above

View Answer


8. What is true about $group stages in aggregation framework ?

A. This is a filtering operation and thus this can reduce the amount of documents that are given as input to the next stage.
B. This does the actual aggregation
C. Sorts the documents
D. None of the above

View Answer


9. What is true about $skip stages in aggregation framework ?

A. This is a filtering operation and thus this can reduce the amount of documents that are given as input to the next stage.
B. This limits the amount of documents to look at, by the given number starting from the current positions.
C. With this, it is possible to skip forward in the list of documents for a given amount of documents.
D. None of the above

View Answer


10. Which stages in aggregation framework is a filtering operation and thus this can reduce the amount of documents that are given as input to the next stage?

A. $limit
B. $match
C. Both A and B can be used
D. None of the above

View Answer





Discussion



* You must be logged in to add comment.