How to request such a structure:
public class Animal extends RealmObject {
RealmList<Bird> birds;
}
public class Bird extends RealmObject {
int type;
RealmList<RealmInteger> species;
}
RealmInteger is an object with int value
I want to find all Animalobjects with Birdthat have the form value3 AND, which Birdmatters type2
I tried this, but it ignores type:
realm.where(Animal.class)
.equalTo("birds.type", 2)
.equalTo("birds.species.value", 3)
.findAll();
I assume that it matches the value, but does not check the type field at the same time. Do I need to do .equalTo("birds.species.value", 3)to check only "Birds" type2?
Update : I tried @EpicPandaForce answer below, it also returns this Animal with data:
"birds": [
{
"species": [3, 15, 26],
"type": 1
},
{
"species": [],
"type": 2,
}
]
Since this one Animaldoes not have the form of valueof 3 (empty) type2, it should NOT return it. However, this is happening.