【发布时间】:2019-02-05 11:32:24
【问题描述】:
我有以下文档结构。我正在尝试使用 $pull 从组件数组中删除组件。我不知道如何从以下文档中选择“mast”或“commsbox”。
{
"_id" : ObjectId("23456yujbvfdfg"),
"d": 1234567,
"components" : [
[
"mast",
{
"foo":"bar"
}
],
[
"commsbox",
{
"BLARN": "bAAA"
}
]
]
}
我试过了
db.sites.update({components: {$exists: true}, {$pull: { components.mast: {$exists: true} } } }).pretty();
但我无法正确选择组件。
【问题讨论】:
标签: mongodb mongodb-query