0

The principle is that user can post opinions and only his friends can see them

So I will show you the data model and explanations to understand well

'User' table:

objectId, username, email etc... (all of default fields provided by Parse and many others but not necessary to quote for my question)

friends; Array - it contains all the users (objectid) that are friends with him -

updatedAt; (provided by default)

createdAt; (provided by default)

'Opinion' table:

objectId;

senderId; Pointer User table

content; String

updatedAt; (provided by default)

createdAt; (provided by default)

So I though about some tricks, querying all users before and do a restriction with with "wherekey:@"objectId" containedIn:"[[PFuser currentUser] objectForKey:@"friends]" following by a query on the Opinion table restricting Opinions posts only to current User's friends... but without results...

Does anyone knows an easier way the to do this ?

Lkm
  • 113
  • 11
  • You can use PFRelation in case if you expect lots of friends. Arrays are supposed to be used for a few objects, otherwise it looks good. – pronebird Mar 10 '15 at 20:31
  • In my opinion, also, from what I already have implemented, it is best to implement a friends table. – jsetting32 Mar 11 '15 at 06:05

0 Answers0