db.getCollection('alert').aggregate([{
"$match":{
"_id":{
"$in":[]
}
}
},
{
"$addFields":{
"state":"RESOLVED",
"log":{
"$concatArrays":["$log",[{ "message": "HOT alert"}]
}
},
{
"$out":"alert"
}
])
My mongodb version is 4.0.4 I am using above query to update alerts match with first pipeline. I don't know why after I run this query, the records not match with conditions were deleted. If match, the records is updated and don't be remove, just records not match with condition be removed.
Please check and help me. How I can keep all record not match with condition but still update match records