Saturday, 15 February 2014

ios - PFQuery querying n number of PFUser and PFObjects -



ios - PFQuery querying n number of PFUser and PFObjects -

i'm using parse.com , have question regarding relational database. have user class (the default _user class) 1 of columns has "friends" array. friends array consists of pointers other users.

what want populate facebook-style timeline @ origin of app query current user array of friends , posts, queries user's array of friends , posts.

i have friends array. can query current user, , can query specific user.

my question is, how efficiently query posts on n number of users's posts? while can query specific users 1 1, gets slow if user has 100+ friends since need query each of friends posts.

thank you. ps: i'm using ios.

i assume have post class maintain users' posts. can posts of number of users using containedin

pfquery *query = [pfquery querywithclassname:@"post"]; [query wherekey:@"user" containedin:friends]; //friends array of users

or can go matcheskey. code anypic example:

pfquery *followingactivitiesquery = [pfquery querywithclassname:kpapactivityclasskey]; [followingactivitiesquery wherekey:kpapactivitytypekey equalto:kpapactivitytypefollow]; [followingactivitiesquery wherekey:kpapactivityfromuserkey equalto:[pfuser currentuser]]; followingactivitiesquery.limit = 1000; pfquery *photosfromfollowedusersquery = [pfquery querywithclassname:self.classname]; [photosfromfollowedusersquery wherekey:kpapphotouserkey matcheskey:kpapactivitytouserkey inquery:followingactivitiesquery]; [photosfromfollowedusersquery wherekeyexists:kpapphotopicturekey];

ios relational-database parse.com

No comments:

Post a Comment