How to get only changed value on Firebase Database? Because every time I changed a value on dir
, ex:
/ some_user
~ id
~ name
/ data
~ order_id
~ order_name <<= Changed in here
But when I get the changed data, I get all the tree structure and not only changed data order_name
. So I just wanted it to return something like this:
/ some_user
/ data
~ order_name <<= Specific changed data
So I can identify what is the exact key
data that has changed. How can I do this? Thanks.
Attach the listener to the order_name reference.
var user = "Alan";
var ref = firebase.database().ref(user + "/data/order_name");
ref.on("value", function(snapshot) {
console.log(snapshot.val());
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With