-
Notifications
You must be signed in to change notification settings - Fork 150
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
Set Data Type #1206
Comments
How should this be prioritized? 1.0? |
I think this depends on arrays of primitives and/or a clearer definition of equality between objects. I.e., a lot of potential thought needs to go into this. :) |
This is not very high priority right now, and definitely not a priority for 1.0. But now that we have Sync, we need to start focusing on more expressive data types that allows users to express how they want the data to behave (in a way that we can enforce during merges).
It would be nice to support both sets of objects and primitives, but depending on timing of the support for lists of primitives, I don't think it would be a problem to start with objects only. With regards to equality, are you thinking of whether we are talking about the same object or objects with the same values? My assumption would be that it should be based on the object itself, rather than what it contains (since that can change). |
Another data type that would be useful is an ordered set. When working on RealmTasks (realm/realm-tasks#179) I had to add a notification block that detected if more than one reference for an object with a primary key was added to a LinkList and manually deduplicate it, but that's wasteful and inelegant, though I think sufficiently robust for my needs. |
Actually, see this PR instead: realm/realm-tasks#180 |
Any news about this? In Realm-Java, btw, there's a lot of interest in this feature realm/realm-java#759 |
Another use case for this is during Client Reset. Right now, if multiple clients are receiving a Client Reset for the same Realm and are then copying list elements from the old Realm, you will see duplicated list elements on the server due to how merges work. Right now there isn't any great to avoid this. |
To emphasise @cmelchior's point, here's another case where a set should be used instead of a list: https://github.com/realm/realm-sync/issues/2638 |
Same as
LinkList
, but only supporting adding and removing elements (no positional insert), and disallowing duplicates (continually adding the same object is idempotent).This can be done manually with the current
LinkList
with a check before insert, but it need to be a separate type for Sync to work.The text was updated successfully, but these errors were encountered: