I have a MongoDB collection as follows
[
{
actions: [
{
_id : ObjectId('641b34b7aa7f4269de24f050')
participants: [
{
_id : ObjectId('641b33c3aa7f4269de24ef10')
referenceId: "641b3414aa7f4269de24efa5",
name: "Person one",
email: "example@gmail.com"
},
{
_id : ObjectId('61bb9105362e810ae9a6826f')
referenceId: "641b3414aa7f4269de24ef4g",
name: "Person two",
email: "example2@gmail.com"
}
]
}
]
}
]
I want to update participants' name by filtering participants' referenceId.
As an example, I want to update the document where referenceId = 641b3414aa7f4269de24efa5 and then update the name to "Person 1".Then the document will look like this after update
[
{
actions: [
{
_id : ObjectId('641b34b7aa7f4269de24f050')
participants: [
{
_id : ObjectId('641b33c3aa7f4269de24ef10')
referenceId: "641b3414aa7f4269de24efa5",
name: "Person 1",
email: "example@gmail.com"
},
{
_id : ObjectId('61bb9105362e810ae9a6826f')
referenceId: "641b3414aa7f4269de24ef4g",
name: "Person two",
email: "example2@gmail.com"
}
]
}
]
}
]
Is there any way that I can perform this