【发布时间】:2017-09-13 05:54:30
【问题描述】:
我在 MongoDB 中有一个包含对象列表的集合。每个对象都有一个“更新器”数组,它们是具有我要更新的字段的对象。该数组中的一个更新程序需要更新描述。我怎样才能只更新更新程序对象的描述,我知道“updaterId”。
更新:
在我看来,设置标志 multi: true 将在 Mongo 2.2+ 中发挥作用。
db.configurations.update(
{"updaters.updaterId": "90391154-67BB-452E-A1A7-A07A98B94F86"},
{$set: {"updaters.$.description": "This tool will prevent users from Unloading Linked Revit files for \"all users\" which causes such Linked File to be unloaded by default when opening project."}},
{multi: true}
)
【问题讨论】:
标签: mongodb