Very Similar to the questions posed here:
https://mongodb.prakticum-team.ru/community/forums/t/how-to-toggle-a-boolean-field-in-an-array-using-set-and-positional-operator/223560
I am wanting to do the same thing but in golang.
So if I have
{
"_id": "61a02dc3e044cc34ce8a3a2f",
"name": "Product 1",
"status": true,
"items": [
{
"_id": "61a02dc3e044cc34ce8a3a30",
"foodName": "Item 1",
"price": 10,
"status": true
},
{
"_id": "61a02dc3e044cc34ce8a3a31",
"foodName": "Item 2",
"price": 20,
"status": false
}
]
}
And Similarly, If want to toggle the status boolean of “_id”: “61a02dc3e044cc34ce8a3a31”, how can that be accomplished in Go.