How do you change only one array element of an object in firebase using ionic?

0

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());
})
    
asked by anonymous 31.05.2018 / 15:38

0 answers