angularjs - Firebase: How do I limit number of child objects in a query for its parent? -
in firebase have users collection in each user has child "posts" contains multiple posts (like facebook). on each user page load posts in 1 query user object. on time number of posts become large.
- what "right" way limit number of posts come without making separate call (or way)? plan implement infinite scroll.
- generally speaking bad practice make multiple calls angular/firebase stack? can direct me "best practices" resource?
thanks lot help!
edit
for user collection looks
users : { user1 : { posts : [<post>], username : <username> ... }, user2 : { posts : [<post>], username : <username> ... }, ... }
you can limit number of items take using limittofirst , limittolast functions.
to implement pagination, though, you'll might want use startat , endat. combine once paginated data once.
in fact, firebase has example of pagination using startat, limittofirst , once.
Comments
Post a Comment