Accessing Data In Firebase Database
So basically,I have a web application that uses firebase database. and I am having a hard time on how to access the encircled ones? here is my code: function getDataFirebase() {
Solution 1:
Loop over snapshot returned from firebase to get values inside the object.
functiongetDataFirebase() {
returnnewPromise(function(resolve, reject){
refReview.on("value", asyncfunction(snap){
let rootkey = snap.keyconsole.log(rootkey)
snap.forEach(snapshot => {
let childKey = snapshot.keyconsole.log(childKey)
Object.keys(snapshot.val()).map(k => {
console.log(snapshot.val()[k])
})
})
})
})
}
This case falls when we don't know the value of generated timestamps from firebase as child nodes.
Post a Comment for "Accessing Data In Firebase Database"