-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
Importing objects through a RealmAny field does not check for duplicate references to the same object, thus the following test will fail as the child is imported multiple times:
@Test fun importWithDuplicateReference() = runBlocking { realm.write { val child = Sample().apply { stringField = "CHILD" } val parent = Sample().apply { nullableRealmAnyField = RealmAny.create(child) nullableRealmAnyListField = realmListOf(RealmAny.create(child)) } copyToRealm(parent) } assertEquals(1, realm.query<Sample>("stringField = 'CHILD'").find().size) }