MongoDB DEV · Question 64 · Multiple choice

Consider the following query against the items collection: db.items.updateMany( { $and: [ { price: { $gte: 5 } }, { price: { $lte: 7 } } ] }, { $set: { quantity: 12 } } ) Which of the following documents will be updated by this query? Check all that apply:

Answer options

  1. A.
    { "_id": 44, "name": "gizmo", "price": 6, "quantity": 5 }
  2. B.
    { "_id": 22, "name": "wrench", "price": 7, "quantity": 4 }
  3. C.
    { "_id": 55, "name": "widget", "price": 10, "quantity": 17 }

Answer confidence: High

Correct answer: A, B

Explanation language: Chinese

过滤条件是 price >= 5 且 price <= 7,因此 price 为 6 的 gizmo 与 price 为 7 的 wrench 都会被 $set quantity:12。price=10 超出了上界,不会被更新。

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 ↗