i want to to update child value depending on categoryId. I tried following this tutorial Firebase DB - How to update particular value of child in Firebase Database. It’s work, but it’s not storing in the same ref. It’s store in another ref.
https://i.stack.imgur.com/SaqjD.png
firebase.database().ref('usuario')
.on('value',event =>{
event.forEach(user =>{
user.child('eventos').forEach(evento =>{
if (evento.val().categoryId === payload.id){
//Here is where i try to update the childe value, in my case category
let ref = firebase.database().ref('usuario/'+user.key+'/'+evento.key+'/'+evento.val().category)
.set(payload.name)
console.log(ref)
}
})
});
});