I have a posts
collection in which my application stores all the posts of a user, with the following data structure:
+ 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)
Now, I would like to display all the posts of this collection to my user; but only, if the user follows the person who created the post, i.e the uid
field of the post document fits.
I know that it is simple to query the collection if the user only follows one person, i.e. I have one simple where
clause. But: What if my user follows 10.000 people or more? How can I query that?
Also, how should I store the followings
, i.e. the persons a user follows? Using a simple array doesn't seem suitable for me, but with all the other options I can't query the posts collection for posts that come from a person I follow.
I would be grateful for every help I could get!