I am using Angular 4 Firebase and AngularFire and i have the following firebase database
\"users\" : {
\"Test1\" : {
\"totalscore\" : 50,
\"user
The orderByValue
is used when you have a data structure like this:
"userscores" : {
"Test1" : 50,
"Test2" : 30,
"Test3" : 20
"Test4" : 10,
}
In the above you want to order the results of your query on userscores
on the value of each child node.
In your case, the value you want to sort on is in a child property totalscore
under users
. So you should use orderByChild:
this.topusers = db.list('users', {
query: {
orderByChild: "totalscore",
limitToFirst: 10,
}
});