假设我有一个集合allitems
,其中每个文档的格式为
{_id: "1", items: [{number: 1, main: "how are you?", sub:[{id:1, item: "does it change with the day?", score: 0},{id:2, item:"some other question", score: 0}]}]}
如何更新子项的分数?
我试过了
db.allitems.update({_id:"1"}, {$set:{'items.0.sub.0.score': 5}});
我收到此错误:
error: {
"$err" : "Unsupported projection option: items.0.sub.0.score",
"code" : 13097
}
我怎样才能解决这个问题?