0

Help me please. I'm trying to find all matches of the field OWNER with array elements.

But the result is an error:

val persons = arrayOf("Anna", "Jon", "Mary")

val accounts = realm.query(AccountStorageItem::class, "owner IN $persons").find()

I try different things but nothing works

This is how everything works fine, but I really need to pass an array:

val accounts = realm.query(AccountStorageItem::class, "owner IN {"Anna", "Jon", "Mary"}").find()
Olesya
  • 1
  • Does this answer your question? [Realm query with List](https://stackoverflow.com/questions/32066648/realm-query-with-list) – plplmax Jan 02 '23 at 10:28
  • Welcome to SO. When you code generates and error, it's usually a good idea to include what the error is in the question i.e. - *But the result is an error* - is not helpful to us. Oh. Are you missing the open and closed parens in the string {}? You can also use [Parameterized Query](https://www.mongodb.com/docs/realm/realm-query-language/#parameterized-queries) and substitute the array into $0. – Jay Jan 02 '23 at 18:22

0 Answers0