I have 2 tables like so:
- Posts
- objectId (default objectId)
- content (text)
- Comments
- objectId (default objectId)
- post (pointer to Posts)
- text (text)
I've been trying to grab Posts that don't have comments.
Here's what I've tried so far:
PFQuery *query_comments = [PFQuery commentQuery];
[query_comments whereKeyExists:@"post"];
[query_comments selectKeys:@[@"post"]];
PFQuery *query_posts = [PFQuery postsQuery];
[query_posts whereKey:@"objectId" doesNotMatchKey:@"post" inQuery:query_comments];
[query_posts findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
printf("\n\n");
// objects should now contain all Posts that don't have comments
}];
Edit
Currently, the query_posts ignores the query_comments and just fetches posts like normal (as if the query_comments didn't exist).