I have a logic problem in my app using Parse, Regarding which path to choose to save in traffic, and if someone has already faced a similar problem, I will really appreciate the help. Also, you can end up helping other developers facing the same problem
I have a social app where there is a feed with objects, and users can bookmark ("favorite") these objects
I studied the Parse documents and concluded that among the pointers, relations and arrays, the best way to store favorite would be a objectId's array stored in the class of users. Each time an object is bookmarked by the user, the ObjectID of this object is stored in a objectID's array belonging to that user. The reason for the choice is:
It is easy to create the bookmark's view and show them to the user, since I just have to search for the user's ObjectID's array and finding those present in the class of objects
Saving only the objectID and not the entire object, I will save in traffic and I keep the app and traffic clean
But my logic problem is as follows. If user1 has created an object, and user2 bookmarked it, and then user1 decided to delete the object, I would have to search the objectID of this deleted object in each favorite array of each user!
So my question is, what would be less expensive for traffic of my App? Store the entire object when a user bookmark it, automating removal when a user deletes the object? Or just store the ObjectID, and perform the search on each array for each user when this object is deleted?
You can create Parse class for your feed objects. After that create an array column to store objectIds of users who added your feed item to favorit. When you want to find all the objects specific user bookmarked do something like
To remove object simply do
Hope that helps :)