I have a data as below.
[
{
"id": 1,
"exist": true
},
{
"id": 2,
"exist": false
},
{
"id": 3,
"exist": false
}
]
Only one object can have exist true. So when I findOneAndUpdate({_id:2}),{exist:true}), I hope that exist of 'id:1' is changed to false automatically in one query using aggregate or etc.
could you recommend some idea fot it? Thank you so much for reading my question.