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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -