I have a Firebase database that I need to retrieve some data from: My database is set up like this:
I wish to pull the value of Addition and plus one. I have been trying with transaction but that was resulting in countless errors so I gave up on that and tried pulling it then updating it, but I was getting the value of undefined when I console logged it.
My code:
var numbere;
var cb= "Addition";
firebase.database().ref(UserIDKey+cb).once('value').then(function(snapshot) {
numbere = snapshot.val().numbere;
});
console.log(numbere);
Any help would be great I have spent many hours trying to get this to work. (I am not very good at Firebase).This is for a school assignment and this is the last thing I need in order for it to work. Thanks in advance.