Exam C100DEV Topic 1 Question 14 Discussion

Actual exam question for MongoDB's C100DEV exam
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

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

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.

0
0
0
10