Exam C100DEV Topic 1 Question 14 Discussion
Actual exam question for MongoDB's C100DEV exam
Question #: 14
Topic #: 1
Question #: 14
Topic #: 1
A collection called players contains documents with the following structure: { _id: 1, user: 'Tom', scores: [ 23, 56, 3, 52, 62 ], bonus: 5 } { _id: 2, user: 'Jane', scores: [ 42, 50, 10 ], bonus: 3 } You have the following query: db.players.aggregate([{ $addFields: { total_score: { $sum: '$scores' }, avg_score: { $avg: '$scores' } } }, { $addFields: { total_score_with_bonus: { $add: ['$total_score', '$bonus'] } } }, { $match: { bonus: { $gt: 4 } } }]) How can you optimize this query?
Suggested Answer: A Vote an answer
https://docs.mongodb.com/manual/reference/operator/aggregation/match/ https://docs.mongodb.com/manual/core/aggregation-pipeline-optimization/
by Maxine at Jul 11, 2026, 05:31 PM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).