Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-1996

[Collections in mixed] Query not matching expected elements

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Expected results

      Given a schema:

      class JsonStyleRealmObject(id: String) : RealmObject {
          @PrimaryKey
          @PersistedName("_id")
          var id: String = id
          var value: RealmAny? = null
      }
      

      and a single instance

      JsonStyleRealmObject {
          id = "EMBEDDED"
          value = realmAnyListOf(
              listOf(4, 5, 6),
              mapOf(
                  "key1" to 7,
                  "key2" to 8,
                  "key3" to listOf(9),
              )
          )
      }
      

      The following query will not match anything:

      realm.query<JsonStyleRealmObject>("value[*][*] == {4, 5, 6}").find()
      

      while the almost similar query (with explicit first index) will match the object:

      realm.query<JsonStyleRealmObject>("value[0][*] == {4, 5, 6}").find()
      

      <!-- What do you want to achieve? -->

      I would expect both queries to yield the same match.

      <!-- What happened instead? -->

      See above.

      Steps & Code to Reproduce

      The actual tests are in Realm Kotlin

      Core version

      Core version: v13.26.0-175-g5c367320a

            Assignee:
            jorgen.edelbo@mongodb.com Jørgen Edelbo
            Reporter:
            unitosyncbot Unito Sync Bot
            AD Core
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: