I would like to retrieve the data of a node which is inside some other nodes (in the firebase database) without having those parents nodes's names. How can I do it? Thank you.
This is what I have tried. ("this" in the database is inside some other nodes).
var this = this.id;
var thisDbData = firebase.database().ref(this);
thisDbData.on('value', function(snapshot){
var name = snapshot.child('name').val();
console.log(name);
});
The "name" variable returns null. This is the database structure:
{
"products" : { //I have access to this name
"W9bgPeMeYieEvP2FGb9ZOvvhx0T2" : { //I don't have access to this name
"-Lh0CbgAW8R2-vjMELqr" : { //I have access to this name
"description" : "________", //What I wanna get
"name" : "_______" //What I wanna get
},
"-Lh0IqYJeS91dM6Qurye" : {
"description" : "______",
"name" : "______"
}
}
}
}