I have an entity MyEntity that has a tags to-many relationship, so tags is an NSSet of MyEntity. It's optional, so some MyEntity's don't have tags. Here's what I'm trying to do:
predicate= [NSPredicate predicateWithFormat:
@"(rootId == parentId AND NONE tags.tagName == %@)", @"badTag"];
So I want to get all MyEntitys where rootId == parentId and don't give me any entities if its tags has a tag named "badTag". The problem with this is that if the entity does not have any tags at all, that entity is not returned. I've tried a variation of the above:
@"(rootId == parentId AND ANY tags.tagName != %@)", @"badTag"];
But this gives the same result. How can I make this predicate work for the case where the entity does not have any tags at all?