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 https://github.com/realm/realm-java/issues/7228 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 (https://github.com/realm/realm-java/blob/master/realm/kotlin-extensions/src/main/kotlin/io/realm/kotlin/RealmQueryExtensions.kt) in the meantime.

1 Like