0
如果我有使用以下結構的幾個文件:MongoDB中查找所有評論
{
"_id" : ObjectId("4f9c6fe033cddec1bea430f2"),
"title" : "Product #1",
"comments" :
[
{
"comment" : "My comment",
"date" : "2012-03-01 00: 00: 00",
"name" : "Test Name",
"username" : "Test Username"
},
{
"comment" : "My comment",
"date" : "2012-03-01 00: 00: 00",
"name" : "Test Name 2",
"username" : "Test Username 2"
}
]
}
是否有可能對我來說,找到有reviews.name並更新所有文件?例如說,我想查找所有具有user.name的文件:test name 2並將其更改爲Cassie。那可能嗎?如果不是最好將評論放在不同的集合中?
感謝您的幫助 – cKendrick