Or request with inclusion

I have a join table with column and column. Both columns indicate custom objects. When executing this OR query, it throws an error: "OR queries do not support include subqueries"

Is there any way around this? Thanks!

// configure the request to receive all relations when the current user is friends with another user.

 PFQuery *userIsFriendSender = [PFQuery queryWithClassName:@"UserRelationships"]; [userIsFriendSender whereKey:@"from" equalTo:[PFUser currentUser]]; [userIsFriendSender whereKey:@"active" equalTo:@YES]; [userIsFriendSender includeKey:@"to"]; // set up query to get all relationships where a use friended the current user PFQuery *userIsFriendReceiver = [PFQuery queryWithClassName:@"UserRelationships"]; [userIsFriendReceiver whereKey:@"to" equalTo:[PFUser currentUser]]; [userIsFriendReceiver whereKey:@"active" equalTo:@YES]; [userIsFriendReceiver includeKey:@"from"]; PFQuery *query = [PFQuery orQueryWithSubqueries:@[userIsFriendSender, userIsFriendReceiver]]; 
+6
source share
1 answer

Try moving the includeKey: to the general query.

 PFQuery *query = [PFQuery orQueryWithSubqueries:@[userIsFriendSender, userIsFriendReceiver]]; [query includeKey:@"from"]; [query includeKey:@"to"]; 
+17
source

Source: https://habr.com/ru/post/958758/


All Articles