json - Structuring a friend list in a Firebase database -
i looking best way (or @ least right way) implement friend system firebase database in each user in database has own information (his name, profile picture, email, etc.) , friend list.
the problem can't think of good, efficient way store information inside database, example, if store data in following way -
{ "users": { "johnappleseed": { // name, profile picture url, email, phone, etc... "friends": { "alice": true, "bob": true, "james": true, "johnappleseed2": true, // ... } }, "johnappleseed2": { // ... } } }
and want app show list of friends of user (which shows friends' names, profile pictures, etc.) still need perform server request each one of friends in list (while, afaik performing lots of server requests considered bad practice) grab whatever information want display beyond username... also, happens when user changes username?
can suggest better solution or structure make more sense?
there read structuring data on firebase on https://firebase.google.com/docs/database/web/structure-data
in case this
/users: 21532761536: <-- user id name: henk birthdate: 14-05-2016 27361726362: name: priscilla birthdate: 14-05-2016 /friends: 21532761536: <-- user id (henk) 27361726362: true, <-- friends user id (priscilla) 18237821732: true, 27361726362: 72163721637: true,
Comments
Post a Comment