Is it possible to use "NOT IN" in a NSPredicate with a SUBQUERY?
In a 'normal' NSPredicate, this works:
NSPredicate(format: "NOT (uid IN %@)", uids)
However, I'm trying this "NOT IN" syntax in a NSPredicate with SUBQUERY and it doesn't work (but doesn't crash either):
NSPredicate(format:"SUBQUERY(forests.treeFamily, $tree, NOT ($tree._id IN %@)) .@count > 0", arrayOfTreesIds)
While the following "IN" syntax works fine:
NSPredicate(format:"SUBQUERY(forests.treeFamily, $tree, $tree._id IN %@) .@count > 0", arrayOfTreesIds)
Any idea how I could achieve this?
UPDATED
The answer I got from Jay made me think I wasn't clear enough on the schema/class.
So let's make an example with dogs.
We have a ShelterClass, that has a property of Dogs. It's an array of Dog objects, to keep tracks of which dogs are hosted in the shelter.
The Dog class has a "race" property, which is a reference to a Race class.
I want to filter Shelters that DON'T have certain races of dogs. While I would use this to filter Shelters that DO have certain races of dogs:
NSPredicate(format:"SUBQUERY(dogs.race, $race, $race._id IN %@) .@count > 0", arrayOfRaceIds)
I can't find how to filter out / use a "NOT IN" syntax.