I'm having Drinks and those have a relation ship called Types.
Drinks can have many types and types can have many Drinks.
Now I want to create a query that gives me all Drinks that are of type "sweet". Thats easy but now I'm having array of types and I want a query that gives me all Drinks that matches ANY of the types in the array.
I'm now working around this for my countries like this:
List<String> filterCountries = mGson.fromJson(prefsUtil.filterCountries(), mType);
if(filterCountries != null) {
realmQuery.beginGroup();
for (int cursor = 0; cursor < filterCountries.size(); cursor++) {
String country = filterCountries.get(cursor);
realmQuery.equalTo("country.name", country);
if (cursor != (filterCountries.size() - 1)) {
realmQuery.or();
}
}
realmQuery.endGroup();
}
But I think this is an ugly solution. But I don't find anything to do this?