Data structure question - linked collections (pointers) or objects?
I have a bit of a best practices question.
In my app users register/login. I'm using the standard user collection with a few extra columns for email, fname, lname, birthday, etc.
The primary functionality of the app is to sync with users facebook and instagram accounts, provide lists of their friends, and allow them to select some or all of these connections to track within my app. I will be storing (and subsequently using) the IDs (facebook/instagram) of their friends to pull pictures, posts, etc. but I want to compile these (and possibly other social services in the future) within a 'friend profile' in my app.
i.e. I have a entry in my app with a unique ID, named John Smith that also contains an image a tagline and the IDs to identify that person in facebook/instagram/etc. for later use. Each of these entries (objects?) obviously need to be tied to my app user who is adding them and 'owns' them.
My question is, what is the best/most efficient way to handle this structure.
Should I simply add a column to the user collection of type 'object' and store (what could be 5-100) arrays of information in the single column? This seems like the simplest approach as I will only really need this one collection and all user info is neatly contained within a single row - however this one column could become quite large as each user could have dozens of these profiles stored, each with 10+ primitive data types in each.
Alternatively should I create a new collection called 'friend_profiles' where each profile is on a new row and has a separate column for the 10+ data points (plus another which is a 'pointer' back to the user ID)? This spreads out the information into a bunch more columns and seems cleaner in some ways, but also seems like it might be unnecessary and make listing all the 'friend profiles' of one of my apps users more difficult.
Is one better than the other? Will it make the app quicker, make it easier to add/remove/edit/list results? Is there another way that I'm not even considering?
Hoping someone with more data architecture experience can help point me in the right direction and maybe save me some grief down the road.
Thanks so much. Appery.io is making my dreams come true! ![]()