在mongodb中使用$ pop苦苦挣扎。假设我有以下集合:
`{_id:3
name: "item 1",
subdoc:{
array:[
{id: "999",
name:"bar"
},
{id: "777",
name:"foo-bar"
}
],
anotherproperty: "foo"
}
}`
鉴于它是id,我想从subdoc.array中删除一个项目。
因此,对于上面的文档,如何删除id =“999”的项目,以便subdoc.array中唯一剩下的项目是id =“777”的项目?