MongoDB DBA · Question 156 · Single choice

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:

Answer options

  1. A.
    0
  2. B.
    1
  3. C.
    2
  4. D.
    3
  5. E.
    4

Answer confidence: High

Correct answer: A

Explanation language: Chinese

过滤条件是 state: "NY",而集合里三个文档的 state 只有 "WA" 和 "CA",一个都没有匹配上。没有文档被修改,也就不会产生任何 oplog 条目(oplog 只记录真正发生的写操作),所以答案是 0。

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 ↗