I have the following data structure
{
"carro" : {
"-LDqO3v1IBcV2CC7MRhi" : {
"donos" : [ {
"key" : "-LDO7wjhNgyjGhjJ1_G4",
"nome" : "wagner"
} ],
"modelo" : "ford ka"
},
"-LDqO7G8d6HmZFVi3NKb" : {
"donos" : [ {
"key" : "-LDP7nckWZa7SVmNI4WI",
"nome" : "fdsal"
} ],
"modelo" : "ford gt"
}
},
"dono" : {
"-LDO7wjhNgyjGhjJ1_G4" : {
"cidade" : "belém",
"idade" : "22",
"key" : "",
"nome" : "wagner"
},
"-LDP7nckWZa7SVmNI4WI" : {
"cidade" : "afdkslajç",
"idade" : "25",
"key" : "",
"nome" : "fdsal"
}
}
}
I'm trying to change a specific element of the array owners when I have some change in the owner's collection so
this.db.list("dono").query.on("child_changed", (childSnapshot, prevChildKey)=>{
this.db.list("carro").query.orderByChild("donos")
.startAt(childSnapshot.key).ref.set(childSnapshot.val());
})