PFQuery *teamQuery = [PFQuery queryWithClassName:@"Team"];
[teamQuery whereKey:@"winPct" greaterThan:[NSNumber numberWithDouble:0.5]];
PFQuery *userQuery = [PFQuery queryWithClassName:@"User"];
[userQuery whereKey:@"hometown" matchesKey:@"city" inQuery:teamQuery];
[userQuery findObjectsInBackgroundWithBlock:^(NSArray *results, NSError *error) {
}];
[query whereKey:@"arrayKey" equalTo:[NSNumber numberWithInt:2]];
[query whereKey:@"post" equalTo:[PFObject objectWithoutDataWithClassName:@"Post" objectId:@"1zEcyElZ80"]];
PFQuery *innerQuery = [PFQuery queryWithClassName:@"Post"];
[innerQuery whereKeyExists:@"image"];
PFQuery *query1 = [PFQuery queryWithClassName:@"Comment"];
[query1 whereKey:@"post" matchesQuery:innerQuery];
[query1 findObjectsInBackgroundWithBlock:^(NSArray *comments, NSError *error) {
}];
[query includeKey:@"post"];
[query findObjectsInBackgroundWithBlock:^(NSArray *comments, NSError *error) {
for (PFObject *comment in comments) {
PFObject *p = [comment objectForKey:@"post"];
NSLog(@"retrieved related post: %@", p);
}
}];
[query includeKey:@"post.author"];
[query findObjectsInBackgroundWithBlock:^(NSArray *comments, NSError *error) {
for (PFObject *comment in comments) {
PFObject *p = [comment objectForKey:@"post"];
PFObject *author = [p objectForKey:@"author"];
NSLog(@"retrieved related post: %@", author);
}
}];