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:
题目选项
- A._id
- B.lastName
- C.firstName
答案置信度:高
正确答案:A、B
解析语言:中文
$project {lastName:1} 只显式保留 lastName,_id 默认仍会被包含,未列出的 firstName 被排除,所以结果集只显示 _id 和 lastName 两个字段。C 的 firstName 不在投影中,不会被显示。