MongoDB DEV · Question 79 · Multiple choice

Consider a collection people that contains the two following documents: { "_id" : ObjectId("5900efbf0986fdb6574b86f6"), "lastName" : "Cross", "firstName" : "William" } { "_id" : ObjectId("5900efbf0986fdb6574b86f7"), "lastName" : "Leniz", "firstName" : "Nathan" } You perform the following aggregation: db.people.aggregate([ { $project: { lastName: 1 } } ]) Which fields are displayed in the result set? Check all that apply:

Answer options

  1. A.
    _id
  2. B.
    lastName
  3. C.
    firstName

Answer confidence: High

Correct answer: A, B

Explanation language: Chinese

$project {lastName:1} 只显式保留 lastName,_id 默认仍会被包含,未列出的 firstName 被排除,所以结果集只显示 _id 和 lastName 两个字段。C 的 firstName 不在投影中,不会被显示。

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 ↗