Firebase,从大量数据中查询特定键

时间:2016-12-04 20:18:17

标签: android firebase firebase-realtime-database firebaseui

非常感谢任何帮助。非常感谢你的时间。

让我们说,Articles节点下有一大堆文章。

"Articles" : {
"article1Key" : {
  "articleAuthor" : "Author",
  "articleFavByNo" : 21,
  "articleKey" : "Key",
  "articleName" : "Name",
  "articlePostedOn" : "21/07/11",
  "articleTopic" : "Topic"
},
"article2Key" : {
  "articleAuthor" : "Author",
  "articleFavByNo" : 21,
  "articleKey" : "Key",
  "articleName" : "Name",
  "articlePostedOn" : "21/07/11",
  "articleTopic" : "Topic"
},
...
"article10Key" : {
  "articleAuthor" : "Author",
  "articleFavByNo" : 21,
  "articleKey" : "Key",
  "articleName" : "Name",
  "articlePostedOn" : "21/07/11",
  "articleTopic" : "Topic"
}

这些文章由一些作者发表。注册用户可以浏览文章,并喜欢它们。受欢迎的articles keys存储在Users节点下的favArticles个人资料中。由于该文章包含大量数据,因此只有文章的keyname存储在User个人资料下。

"Users" : {
"ZtlIQ2d1qJT1XpmHuGxwFSwaiEy2" : {
  "emailId" : "vs@gmail.com",
  "favArticles" : {
    "article1Key" : {
      "name" : "article1"
    },
    "article7Key" : {
      "name" : "article7"
    },
    "article4Key" : {
      "name" : "article4"
    }
  },
  "firstName" : "Vimala",
  "image" : "default",
  "lastName" : "Sridhar"
}
}

让我们说用户已经喜欢了1000篇文章中的约50篇。现在,如果我想在RecyclerView中显示用户喜欢的文章,我应该如何编写查询以从文章列表中选择特定文章?

0 个答案:

没有答案