-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RealmList.remove(RealmObject) does not work #1712
Comments
➤ PM Bot commented: Jira ticket: RKOTLIN-1063 |
There is a difference between removing an object from a list and delete the object: https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/realm-database/crud/delete/#remove-elements-from-a-realmlist |
Hi Kneth, thanks for the reply! Are you referencing this?
If it is intentional that The docs are pretty unclear or wrong here if you look at the examples provided below:
According to my example above, this assertion would fail. Presumably because |
Any changes for this issue? |
Hi @c-villain. I think the issue here is that you are actually looking up the With
The instances To achieve your intent you will have to either ensure that you are removing an up-to-date reference with:
Alternatively you could just operate solely on objects from the
|
I have created #1723 to improve the APIs and/or throw in these case, so will close this issue for now. If the advised details in #1712 (comment) is not fixing your issue, please leave a note and we can reinvestigate. |
How frequently does the bug occur?
Always
Description
If I have two simple RealmObjects, where one is the parent and the other is a list of child objects within the parent, when I call
parent.children.remove(child)
, the child is not removed from the RealmList.It appears that
Collections.removeAt
is overridden in ManagedRealmList, whereasCollections.remove
is not.Stacktrace & log output
No response
Can you reproduce the bug?
Yes
Reproduction Steps
Here's models and tests that demonstrate the issue:
Models
Tests
Note:
RealmInstrumentedTest
is internal to my project, it basically just opens Realm with ourRealmConfiguration
and initializesmyTestRealm
.Of note here is that the assertion in
Test RealmList object remove
fails.Version
1.8.0
What Atlas App Services are you using?
Local Database only
Are you using encryption?
Yes
Platform OS and version(s)
All
Build environment
Android Studio version: Iguana 2023.2.1
Android Build Tools version: 7.4.2
Gradle version: 7.5
The text was updated successfully, but these errors were encountered: