oneOf with array of array of bytes

One of my Realm entities has a field that’s a byte array:

open class MyObj(
    var myField: ByteArray = ByteArray(0)
): RealmObject()

I’m trying to do a query based on a byte array:

fun match(stuff: Array<ByteArray>): List<RealmReceivedCen> =
    realm.where<MyObj>()
        .oneOf("myField", stuff)
        .findAll()

This doesn’t compile. Can’t I do this match? Do I have to convert my field to a String then?

Thanks!
Ivan

I think it is just an oversight when implementing convenience methods for the other types. I have created In and oneOf for binary fields · Issue #7228 · realm/realm-java · GitHub to add it, but as the methods are not optimized and are basically just convenient wrappers around the other query API, you could do your own extension method inspired by the ones for the other types (realm-java/RealmQueryExtensions.kt at master · realm/realm-java · GitHub) in the meantime.

1 Like