In firebase I want to access database written as below.
<script>
function fnReadMails(){
var user = firebase.auth().currentUser;
var ref = firebase.database().ref('/posts/'+user.uid);
ref.on("value", function(snapshot) {
var vardata = (snapshot.val());
console.log(vardata);
});
}
</script>
The problem is that string marked in red is unique push key randomly generated. Whenever I am getting a reference I am able to take ref up to one level upper i.e. userid , but I want to access data inside that key which I don't know as it will be generated for next post automatically.
How to access nested data inside key?
