angularjs - Structuring a 'User-Followers" Node in Firebase -


in firebase database have user-followers node holds user ids along ids of users follow

user-followers   -f2irzkwfutckuvd7uyd0jwwej7t2     -kgkkwy5xesvcfcl9gmh: true     -kgkozpd0gp687j_5zh5: true     -kglkyb8fcfbc-uwsqwx: true 

when fetch list of user's followers, i'll need fetch of followers information, such username, profile pic url, etc. data structure looks this

users   -kgkkwy5xesvcfcl9gmh     -image_url: "http://someurl.png"     -username: "coold00d55'     //etc... 

what best solution accomplish this? can think of

1) fetching array of followers

2) performing lookup of each users info individually, via foreach()

to me seems sub-optimal. there better way? perhaps i'd benefit storing username , image_url under user-followers well?

any input appreciated!

both valid options. suggestion have second idea (storing username , image_url) under different node user-followers 1 clean in case don't want data. depending on how want access data second idea might better if high throughput needed. added work have write code make sure other list updated (perhaps can use new functions available firebase).


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -