I'm an iOS developer and to be honest I'm not really looking to become a database expert right at this moment, but I do need to know how to properly plan out what I believe to be a pretty cookie cutter social network style backend/database.
I'll keep this short and sweet:
Social network app will have users, posts, comments, and favorites.
Using comments as an example:
Each comment is an object that has been created in my backend for a class called "Comments" (Is this overkill? I don't see how else it could be achieved but I just can't believe how a server would handle so many individual comment objects if an app became popular, but maybe I'm just underestimating the power of a good backend?)
A comment object consists of a URL for the commenter's avatar, the commenter's user ID, a unique object ID, the post object's ID that the comment is for, and the comment text.
Posts and Favorites would also be their own classes/objects in the backend and would follow the same model as comments in the example above.
So my main question is, am I on track with the above? I want to make sure I'm structuring my backend properly.
My second question is, how should the user should keep track of all of their posts, comments, and favorites?
My initial idea was to just have array fields for the User class and store the ID's of the posts, comments, and favorites eg. User class has an array field called "Posts" with ID's of post objects.
The thing that confuses me is, is it overkill to keep track of these in the User class, when I'm storing the User's ID on the post, comment, and favorite classes already? And then I would just query those classes and filter for the user's ID, but then I think about it and if the app had a ton of usage, it might take longer to query all those objects and filter by the user's ID when the user could just keep track of their objects via fields on the User class.
Last but not least, last week I read the following in some Parse.com (popular Backend as a Service) docs:
"When you’re thinking about one-to-many relationships and whether to implement Pointers or Arrays, there are several factors to consider. First, how many objects are involved in this relationship? If the "many" side of the relationship could contain a very large number (greater than 100 or so) of objects, then you have to use Pointers."
I'm confused on what Pointers are in a backend?
I realize these are all pretty noob questions but I really want to make sure I setup my backend properly and make sure that it's structure makes sense.
Hopefully some of you guys will be willing to read this giant wall of text and help a brotha out.
Thanks for the help!