Reputation: 723
In my Firebase I have a users collection in which each user has a child "posts" that contains multiple posts (like Facebook). On each user page I load the posts all in one query for the user object. However over time the number of posts will become very large.
Thanks a lot for your help!
For the user collection it looks thus
users : {
user1 : { posts : [<post>], username : <username> ... },
user2 : { posts : [<post>], username : <username> ... },
...
}
Upvotes: 1
Views: 570
Reputation: 4036
You can limit the number of items you take using the limitToFirst and limitToLast functions.
To implement pagination, though, you'll might want to use startAt and endAt. You would combine it with once to only get the paginated data once.
In fact, Firebase has an example of pagination using startAt, limitToFirst and once.
Upvotes: 1