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.

  1. what "right" way limit number of posts come without making separate call (or way)? plan implement infinite scroll.
  2. 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

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

php - Mongodb connectivity error -