I have a document in mongo like this:
{
"parentId":"1234",
"otherParentProperty":"someProperty",
"nestedArray":[
{
"propertyId":"1234"
"property1":null,
"property2":"some value"
},
{
"propertyId":"5678"
"property1":null,
"property2":"some other value"
}
]
}
How can I copy the value of property2 for each element and set it in the corresponding property1? So the end result will be like :
{
"parentId":"1234",
"otherParentProperty":"someProperty",
"nestedArray":[
{
"propertyId":"1234"
"property1":"some value",
"property2":"some value"
},
{
"propertyId":"5678"
"property1":"some other value",
"property2":"some other value"
}
]
}