Я пытаюсь отсортировать список объектов из базы данных на основе значения дополнительного ключа, но, похоже, не удалось.Я использовал фильтр ref.orderByChild('sort_order')
, но возвращенные данные не в отсортированном формате.Давая ниже структуру моего узла и может ли кто-нибудь помочь мне указать, где я ошибся?
"widgets":{
"fruits":{
"sort_order":"2",
"data":[{
"thread_id":"201902001",
"source_port":"Shanghai",
"source_port_latitude":"31.218399",
"source_port_longitude":"121.434563",
"destination_port":"Singapore",
"destination_port_latitude":"1.32046",
"destination_port_longitude":"103.72042",
"created_on":"2019-02-01 01:02:03"
}]
},
"vegetables":{
"sort_order":"1",
"data":[{
"thread_id":"201902004",
"source_port":"Jebel Ali",
"source_port_latitude":"24.99626",
"source_port_longitude":"55.12536",
"destination_port":"Port Klang",
"destination_port_latitude":"2.999852",
"destination_port_longitude":"101.39283",
"created_on":"2019-02-04 10:11:12"
}]
}
}