Below is the same MongoDB data:
{
"_id":{
"$oid":"5c228169e8cab71a7132c82b"
},
"param1":"ABC",
"param2":[
{
"aid":{
"$oid":"5c228169e8cab7139d10aca7"
},
"param3":"DEF",
"param4":[
{
"lid":{
"$oid":"5c2281685ee3358440f9412f"
},
"param5":"GHI"
},
{
"lid":{
"$oid":"5c22816d5ee3358440f941bb"
},
"param5":"JKL"
},
]
},
{
"aid":{
"$oid":"5c22819de8cab71a7d6db75d"
},
"param3":"MNO",
"param4":[
{
"lid":{
"$oid":"5c2281735ee3358440f9428a"
},
"param5":"QRS"
},
{
"lid":{
"$oid":"5c2281795ee3358440f9431a"
},
"param5":"TUV"
}
]
}
]
}
Problem: How to change values or add any new key-value pair in the param4 array list, like if "param5":"JKL"
need to be changed to "param5":"XYZ"
or adding a new key-value pair "param6":"Hello"
alongwith "param5":"JKL"
so that member array become like:
{
"lid":{
"$oid":"5c22816d5ee3358440f941bb"
},
"param5":"JKL"
"param6":"Hello"
}
I have checked different solutions but all work up to the stage of param4 but not inside the it. Please share any solution