I want to update each element in an array(add score column with value 0) if date exists. Please provide the answer for 3.4 version without using $[] operator as this operator is not supported in 3.4 version
data is like this
{
"u_id" : "79049",
"array" : [
{
"duration" : 1,
"lag" : 0,
"Type" : "2",
"date" : "2019-03-29 06:03:13"
},
{
"duration" : 1,
"lag" : 0,
"Type" : "3",
"date" : "2019-03-29 06:03:13"
},
{
"duration" : 1,
"lag" : 0,
"Type" : "3"
}
],
"Status" : 1
}
data I want in this manner
{
"u_id" : "79049",
"array" : [
{
"duration" : 1,
"lag" : 0,
"Type" : "2",
"date" : "2019-03-29 06:03:13",
"score":0
},
{
"duration" : 1,
"lag" : 0,
"Type" : "3",
"date" : "2019-03-29 06:03:13",
"score":0
},
{
"duration" : 1,
"lag" : 0,
"Type" : "3"
}
],
"Status" : 1
}