我有
现在有两个系列
我尝试更新类似
的数据{
_id: "85a2c512-e670-4bac-a024-c46768e91839"
day: "2013-01-10"
id: "E666A9erpx"
month: "2013-01"
products: [
{
amount: 0
id: "LRRRBKRgBj"
price: 2
},
{
amount: 0
id: "qeeeXGe5G7"
price: 8.9
}
]
year: "2013"
}
我想要$ inc这些值
db.products.update(
{ id: E666A9erpx, 'products.id': [ LRRRBKRgBj, qeeeXGe5G7 ] } ,
{ $inc: { 'products.$.amount': [ 200, 104 ] } }
)
i $ inc怎么办?