从以下架构

时间:2016-03-22 10:54:02

标签: mongodb nosql

我有以下架构,我想从以下架构中删除question_id之一:

enter image description here

我使用了以下查询:

db.getCollection('test').update(
    { },
    { $pull: { sections:{ questions_ids: "SzaGcEr8oZ7fEsrC3} } }
)

但是这个查询没有更新任何内容,当我使用multi:true时,它正在删除整个部分。请更新我在哪里做错了。

1 个答案:

答案 0 :(得分:0)

尝试:

 db.getCollection('test').update(
     { },
    { $pull: { sections:{ questions_ids: ["SzaGcEr8oZ7fEsrC3"]} } }
    )