的陣列拉我有一個集合MongoDB的 - 從對象
{
"_id" : ObjectId("534bae30bf5049a522e502fe"),
"data" : [
{
"0" : {
"content" : "1",
"type" : "text",
"ident" : true
},
"1" : {
"content" : "",
"type" : "text",
"ident" : false
}
},
{
"0" : {
"content" : "2",
"type" : "text",
"ident" : true
},
"1" : {
"content" : "",
"type" : "text"
}
}
]
}
content
是獨一無二的。
我將如何刪除匹配content: '2'
的對象?
我已經試過這樣:
data:{$pull:{"content": deletions[i]}}
其中deletions [i]
是內容。
和幾個變化,但我不能得到它的工作。我錯過了什麼?
你可能從PHP傾倒這個?或者你的內容在mongo shell中看起來像這樣嗎? –
它從外殼看起來像這樣。我應該擔心這個嗎? – user2422960