如何在Firebase Android中创建联接查询

时间:2016-03-17 09:11:08

标签: android firebase firebase-realtime-database

如何有效地执行联接查询以从" 用户"中选择chatId?节点,并使用该聊天从" 聊天"获取消息项目表

示例JSON:(1,2,134和155是随机用户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"
      }
    }
  }
}

0 个答案:

没有答案