In Parse's documentation, we see how to do an inverse of a many-to-many relationship but with just one object to look up. To work from their example of Books and authors, where they know the author and they want to find the books. What I want is to find the books that two or more authors have contributed to.
https://www.parse.com/docs/relations_guide#manytomany-relations
What I've tried is like the following code:
// suppose we have a author object, for which we want to get all books
PFObject *authorA = ...
PFObject *authorB = ...
// first we will create a query on the Book object
PFQuery *query = [PFQuery queryWithClassName:@"Book"];
// now we will query the authors relation to see if the author object
// we have is contained therein
[query whereKey:@"authors" equalTo:authorA];
[query whereKey:@"authors" equalTo:authorB];
The code works sort of.
But, what seems to be happening is if authorA has many books but authorB has one, one book is found in the query. If authorA has one book and authorB has many, many books are found in the query.
What I want is a method to find the books that have both authorA and authorB in its authors relation.