【发布时间】:2020-01-22 09:51:01
【问题描述】:
我有一个 posts 集合,我的应用程序在其中存储用户的所有帖子,数据结构如下:
+ uid (the user id of the creator)
+ text-content : String
+ tagged-users: [String]
+ assigned-media: [{"downloadUrl": String, "storageLocation": String}]
+ type: String
+ typestamp: Timestamp
+ Likes
+ uid (the user id of the liking person)
+ timestamp: Timestamp
+ postId (optional, depending on the results of the collection group queries)
现在,我想向我的用户显示这个集合的所有帖子;但仅当用户关注创建帖子的人时,即帖子文档的 uid 字段适合。
我知道如果用户只关注一个人,查询集合很简单,即我有一个简单的where 子句。但是:如果我的用户关注 10.000 人 或更多怎么办?怎么查询?
另外,我应该如何存储followings,即用户关注的人?使用简单的数组似乎不适合我,但使用所有其他选项时,我无法在帖子集合中查询来自我关注的人的帖子。
我将不胜感激!
【问题讨论】:
标签: firebase google-cloud-firestore firebase-cloud-messaging google-cloud-functions firebase-security