I have 2 PFObjects - a Player let's say, and PlayerStats. There are also several other PFObjects associated with a PFPlayer.
I want to list the Players with the highest scores. The score is contained in PlayerStats.
Now I've tried:
PFQuery *andQuery = [PFQuery queryWithClassName:@"Player"];
[andQuery includeKey:@"playerStats"];
PFQuery *statsQuery = [PlayerStats query];
[statsQuery orderByDescending:@"score"];
[andQuery whereKey:@"miniStats" matchesQuery:statsQuery];
But this doesn't appear to respect the order that the stats are returned in. What I really want to do is order my andQuery by a value in its included class.
I've tried running a basic query and ordering the results afterwards, however I have over 999 players, which is the limit of a PFQuery, so that doesn't help.
I suspect I have to do 2 levels of PFQuery - one for PlayerStats, in order, and then on the results of that query, submit another query using the objectIds of the players to get the Player objects. But this seems cumbersome, especially if I'm only searching for 20 results at a time say.
Ideally there would be something like:
[andQuery orderByDescending:@"playerStats.score"];