realm-java: Query with in() returns an empty RealmResults

Goal

I want to query a table and retrieve objects by their IDS

Actual Results

The RealmResults returns an empty list, even if the objects are in the table (checked with Realm Studio).

Steps & Code to Reproduce

Requesting the table with multiples IDs always return an empty list, but querying the IDs separately returns a list with the object.

realm.where("mytable").equalTo("uid", "firstUID").findAll()-> returns a list with the object realm.where("mytable").equalTo("uid", "secondUID").findAll()-> returns a list with the object

realm.where("mytable").beginGroup().equalTo("uid", "firstUID").or().equalTo("uid", "secondUID").endGroup().findAll()-> returns an empty list

realm.where("mytable").in("uid", new String[]{"firstUID", "secondUID"}).findAll()-> returns an empty list

Maybe it has something to do with the following PR: (Realm Core PR #3250). Reverting to 5.9.1 solved the issue.

Version of Realm and tooling

Realm version(s): ? 5.11.0

Realm Sync feature enabled: No

Android Studio version: ? 3.4 stable

Android Build Tools version: ? 28.0.3

Gradle version: ? 5.1.1

Which Android version and device(s): ? Android API 28, Emulator

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Fixed in 5.13.1

It seems to be a bug with Indexes. The error goes away if you remove Indexes.

Getting this issue as well. In my case the field is marked with @Index but I am only getting 1 or no data back instead of around 20 items. Realm version 5.10.0 works fine still.

Haven’t been able to determine a use-case to make available. Can state though that the query has a equalsTo and a in which is likely the cause