1
我正在制作一个使用Java驱动程序的MongoDB统计系统,我想知道是否有可能(以及如何)更改嵌套在许多对象内的键的值。这里是我的数据库是如何格式化的:更改嵌套对象的值 - MongoDB Java
{
location : “chicago”,
stats : [
{
"employee" : "rob",
"stat1" : 1,
"stat2" : 3,
"stat3" : 2
},
{
"employee" : "krista",
"stat1" : 1,
"stat2" : 3,
"stat3" : 2
}
]
}
因此,例如,我怎样才能将Rob的“stat2”更改为另一个值?我是JSON和MongoDB Java驱动程序的新手。任何帮助表示赞赏!