I am trying to fetch all Box
objects from my Parse database. While doing this, I want to filter out the ones I have pinned to be deleted. I did this by pinning them:
[object pinWithName:@"DeleteObjectPin"];
I simply create another query which gets all objects pinned to be deleted and then make my main query not include those results.
PFQuery *mainQuery = [PFQuery queryWithClassName:@"Box"];
PFQuery *subQuery = [PFQuery queryWithClassName:@"Box"];
[subQuery fromPinWithName:@"DeleteObjectPin"];
[mainQuery whereKey:@"objectId" doesNotMatchKey:@"objectId" inQuery:subQuery];
Make sense? Get objects which don't match objects in this sub query, meaning the ones that I pinned to delete.
So why is it that when I add this whereKey
constraints to my main query, do I get zero results? Note, for example, I have 5 objects without this pin name and 2 with it. Regardless of what the ratio is, I get no results.
Can I expect a query like this to work?
Why not start your object with a default value every time you create it, and change it like you do.
Once you want to fetch all the objects without @"DeleteObjectPin" you just:
PFQuery *objectQuery = [PFQuery queryWithClassName:@"Box"]; [objectQuery whereKey: equalTo:];
// then fetch all the objects with block or something