Please refer the following data structure that is stored in the database as a single document,
{
"_id": "objectId",
"names": [
{
"_id": "objectId",
"first_name": "a",
"is_used": {
"hr": false,
"finance": false
},
"alt_names": [
{
"_id": "objectId",
"first_name": "b",
"is_used": {
"hr": false,
"finance": false
}
}
]
}
]
}
how can we update the alt_names
hr: false
to hr: true
in nested object by using its object id