I have a Friend class and a Friendship class in Parse.com. Friendship class has 2 columns named "Friend1" and "Friend2" that represent the relationship and are pointers to the "Friend" class.
I want to find my 20 oldest friends. So I'm trying a nested query like so in swift:
var queryInner = PFQuery(className: "Friend")
queryInner.orderByDescending("Age")
var queryOuter = PFQuery(className: "Friendship")
queryOuter.whereKey("Friend2", matchesQuery: queryInner)
queryOuter.whereKey("Friend1", equalTo: PFObject(withoutDataWithClassName:"Friend", objectId: friendId))
queryOuter.includeKey("Friend2")
queryOuter.limit = 20
queryOuter.findObjectsInBackgroundWithBlock{
//handling
}
It retrieves 20 friends, but they are not sorted by descending age. Is this a parse problem? a problem with my query? Thanks!