我有一個名爲'question'的集合。它的結構是這樣的:如何更新MongoDB中的數組元素PHP
{
_id:
user_id:
answers:
[
{
answer_id:
answer_content:
}
,
{
...
}
,
...
]
}
現在我知道一個答案的文檔的_id和answer_id,現在我想設置的答案 是例如best_answer(一個字段添加到元):
{
answer_id:
answer_content:
is_best:true
}
我該怎麼做?
這是否意味着JSON? – 2012-03-30 15:03:12
你想要做更新或插入? – 2012-03-30 15:08:03
想做更新 – tinybai 2012-03-30 16:37:07