我有一个文件
playerSettings: [
{
"greenFee":{
"9":{
"fee":1,
"maxPlayers":1
},
"18":{
"fee":1,
"maxPlayers":1
}
},
"playerType":"someOBJID"
},
{
"greenFee":{
"9":{
"fee":1,
"maxPlayers":1
},
"18":{
"fee":1,
"maxPlayers":1
}
},
"playerType":"someOBJID"
}
]
我想使用arrayFilter更新与我的过滤器匹配的greenFee属性,我有这样的东西;
arrayFilters: [{ 'player.playerType': { $in: arrayOfPlayerSettingsPlayerType } }]
其中arrayOfPlayerSettingsPlayerType是playerType IDS的数组。我遇到的问题是通过具有类似这样的数组来将greenFee属性设置为新值;
[
{
"greenFee":{
"9":{
"fee":1,
"maxPlayers":1
},
"18":{
"fee":1,
"maxPlayers":1
}
},
"playerType":"someOBJID"
}
]
但只能将与该playerTypeID匹配的值设置为原始playerType。