How can i effectively perform a join query to select the chatId from the "users" node, and with that chatId get the message items from the "chats" table.
Sample JSON: (1, 2, 134 and 155 are random user id's)
{
"chats" : {
"-KD3x3Y16YdQHWSBXR5K" : {
"-KD3x3Y5zew00h29ZG55" : {
"text" : "hello",
"timestamp" : "1458224515",
"userId" : 1
},
"-KD3x4B1rmbAKTVsOOYn" : {
"text" : "test",
"timestamp" : "1458224517",
"userId" : 1
}
},
"-KD3xLNuLU6IxB85u41S" : {
"-KD3xLNv32FzDuqlXR1V" : {
"text" : "bla",
"timestamp" : "1458224588",
"userId" : 134
}
}
},
"users" : {
"1" : {
"2" : {
"chatId" : "-KD3x3Y16YdQHWSBXR5K"
}
},
"134" : {
"155" : {
"chatId" : "-KD3xLNuLU6IxB85u41S"
}
}
}
}