MongoDB DEV · Question 190 · Multiple choice

Consider a collection grades where all documents contain the following fields: { "_id": ObjectId("590b3e2e5e8cdc2dbd114aa4"), "student_name": "Priya", "homework_scores": [ 97, 100, 99, 100, 100, 93, 100 ], "quiz_scores": [ 96, 98, 92 ], "test_scores": [ 100, 99 ] } You would like to perform an aggregation query that computes the average score across homework_scores, quiz_scores, and test_scores and store the average score in a new field. Which of the following aggregation stages can be used to accomplish this? Check all that apply:

Answer options

  1. A.
    $project
  2. B.
    $count
  3. C.
    $addFields

Answer confidence: High

Correct answer: A, C

Explanation language: Chinese

$project 和 $addFields 都能新增计算字段,可用 $avg 对 $concatArrays 合并后的三组分数求平均并写入新字段。$count 只输出文档条数、不能做逐文档计算,也产生不了新字段——这是本题最容易被误选的干扰项。

Papers containing this question

This question appears in 3 bank records. Public pages combine identical prompts and options. Selected questions display the highest-confidence record; the others show a short preview. Paper-based learning preserves each record's answer, explanation, and confidence.

AUTHOR · PROJECTS · OPEN SOURCE

Author & MongoDB projects

Building data platforms, MongoDB migration and sync tools, and cloud operations products.

Contact the author for any MongoDB needs.

Contact the author ↗mlhp123@outlook.com

Support the author

If this question bank helps you, optional donations are welcome.

Scan with Alipay to support the authorOpen full-size donation image ↗