Hi I wanted to update the firebase data, but when I update it insert to a new data instead of updating the specific data that I set which is the lastname equal to 'hoo'
fb.orderByChild("Lastname").equalTo('hoo').once("value", function(snapshot){ console.log(snapshot.ref()); console.log(snapshot.val()); // var snapref = snapshot.ref(); snapshot.ref().update({ FirstName: 'yoyo1' }); }) Edit:
fb.orderByChild("Lastname").equalTo('hoo').once("child_added", function(snapshot){ console.log(snapshot.ref()); console.log(snapshot.val()); // var snapref = snapshot.ref(); snapshot.ref().update({ FirstName: 'yoyo1' }); }) See the bottom code the new edit code that works by using 'child_added' not using value
