MongoDB DEV · 题目 64 · 多选

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:

题目选项

  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 }

答案置信度:高

正确答案:A、B

解析语言:中文

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

所在套题

此题在题库中有 3 条记录。公开详情合并相同题干和选项;完整公开题展示置信度最高的一条记录,其他题目仅展示摘要。按套学习保留每条记录原有的答案、解析和置信度。

作者 · 作品 · 开源

作者与 MongoDB 作品

专注数据平台、MongoDB 迁移同步与云运维产品研发。

有任何 MongoDB 需求,均可联系作者。

联系作者 ↗mlhp123@outlook.com

支持作者

如果题库对您有帮助,欢迎自愿扫码打赏。

支付宝扫码打赏作者打开打赏原图 ↗