Hi,
Link queries can be a bit tricky. Say you have:
1. four students: 0:id=11, 1:id=12, 2:id=13, 3:id=14
2. three councils: 0: {0, 1}, 1: {0, 2}, 2:{1, 3}
The query realm.where(StudentCouncil.class).notEqualTo("
members.id", 12) should be read as "give me all StudentCouncils with at least one member with id != 12". As all three councils have at least a number with id != 12 (council 0: both, council 1: both, council: one), the three council objects are returned.
In your case, you are probably better off by doing:
for (StudentCouncil sc : realm.allObjects(StudentCouncil) {
if (sc.getMembers().where().equalTo("id", 12).count() == 0) {
// student 12 not member - hurrah!
}
}
Best,
Kenneth
--
Kenneth Geisshirt
Member of technical staff