I want to filter data in Firebase
. I got some queries but I am unable to filter data as per my requirement.
Data :
{
"messages": {
"Data_1": {
"Inner_3": {
"Text": {
"-Kqgd2_QSi5HIlyH6Om3": {
"date": 1501840029764,
"text": "hi"
},
"-Kqgd6zZf51AdKNPrsX8": {
"date": 1501840047829,
"text": "hello"
}
}
}
},
"Data_2": {
"Inner_2": {
"Text": {
"-Kqm5GijxFT54wZRHIJj": {
"date": 1.501931572192E9,
"text": "hi"
},
"-Kqm5YohOG1cFWO-WNGc": {
"date": 1.501931646257E9,
"text": "test"
},
"-Kqm6935IY8Ddj20Z3TN": {
"date": 1.501931802871E9,
"text": "new message"
}
}
}
}
}
}
In above json, If I pass Inner_3
then It should return below result. It checks in all arrays
if Inner_3
is available then give me main layer name with last TEXT
from Inner_3
.
{
"messages": {
"Data_1": {
"Text": {
"-Kqgd6zZf51AdKNPrsX8": {
"date": 1501840047829,
"text": "hello"
}
}
}
}
}
Please help me to achieve this result.