假设文档如下:
{
_id:ObjectId("aafdfefef343fdsfs"),
name:"hehe",
itemList:[
{
itemType:1,
count:100
},
{
itemType:2,
count:100
},
{
itemType:3,
count:100
},
{
itemType:4,
count:100
},
{
itemType:5,
count:100
},
]
}
现在要实现将itemList中itempType为1的count减小1, itempType为5的count减小2,要怎么操作呢?