I'm fetch list data on my realtime database in my app on React Native, but i can't sort as i need to.
My code from request is:
const ref = firebase
.database()
.ref('name_collection')
.orderByChild('key');
I need sort the result by field "key" to desc. What is a method indicated to this?
This is example of my data:
{
"-LyRTCDBTbflu77UpWt5": {
"key": 1,
"title": "Loren ipsun dolor"
},
"-LyRTJyTdrJ3pLo7FED1": {
"key": 3,
"title": "Loren ipsun dolor"
},
"-LyRTNZEBEr6-vKOxOOf": {
"key": 2,
"title": "Loren ipsun dolor"
}
}