I have two entities, Department and Person. Department has a to-many relationship to Person.
The Person entity has a hireDate property.
I'm using the predicate "count(person) = 0 OR none person.hireDate %@" to find Departments without any Persons in them or Departments that haven't hired anyone since a recent date.
When the app first starts up (new user experience) and Departments are inserted and no Person have been inserted, the fetch request with this predicate returns nothing. However, if I create insert a new Person entity and delete it, then save the store, the fetch request will return all the Departments.
I've found a work around where, I just insert a new Person and delete it, then save the store, the fetch request as I expected it to work. I've found that inserting a new Person and deleting it without saving will not correct the problem.
Is this a bug with Core Data or is this a bug with how I've designed my app?