此值保存在集合中
{
name: "jack",
proccess: 1,
point: 60,
cost: 60
},
{
name: "Rose",
proccess: 0,
point: 180,
cost: 360
}
我需要将集合更改为
{
name: "jack",
proccess: 1,
point: 60,
cost: 120
},
{
name: "Rose",
proccess: 0,
point: 180,
cost: 180
}
我使用$addFields
,但删除了另一个字段数据(删除插孔)
$data = $db->user_question->aggregate(
[
[
'$match'=>[
'proccess' => 0
]
],
[
'$addFields' =>[
'cost' => '$point'
]
],
[
'$out' => "user_question"
]
]
);
我无法删除$match
有什么想法(使用update或updateMany)吗?