40. Consider a collection called people that only contains the following documents: { _id: ObjectId("57fd59a2d630a0fd9685a148"), firstName: "Kabir", lastName: "Murthy", state: "WA", city: "Seattle", likes: [ "dogs", "cats", "hiking" ] } { _id: ObjectId("57fd59a2d630a0fd9685a149"), firstName: "Giovany", lastName: "Barnes", state: "CA", city: "Richland", likes: [ "forest", "desert" ] } { _id: ObjectId("57fd59a2d630a0fd9685a14a"), firstName: "Charlie", lastName: "Martinez", state: "CA", city: "San Diego", likes: [ "desert", "beach" ] } { _id: ObjectId("57fd59a2d630a0fd9685a14b"), firstName: "Dawn", lastName: "Wong", state: "WA", city: "Seattle", likes: [ "forest", "mountains", "hiking" ] } How many oplog entries are created as a result of this updateMany operation? db.people.updateMany( { "state": "NY" }, { "$push": { "likes": "hot dogs" } } ) Choose the best answer:
题目选项
- A.0
- B.1
- C.2
- D.3
- E.4
答案置信度:高
正确答案:A
解析语言:中文
过滤条件是 state: "NY",而集合里三个文档的 state 只有 "WA" 和 "CA",一个都没有匹配上。没有文档被修改,也就不会产生任何 oplog 条目(oplog 只记录真正发生的写操作),所以答案是 0。