Skip to content
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

Closed
astigsen opened this issue Oct 8, 2015 · 8 comments
Closed

Set Data Type #1206

astigsen opened this issue Oct 8, 2015 · 8 comments
Assignees

Comments

@astigsen
Copy link
Contributor

astigsen commented Oct 8, 2015

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.

@danielpovlsen
Copy link
Contributor

How should this be prioritized? 1.0?

@simonask
Copy link
Contributor

simonask commented Oct 9, 2015

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. :)

@astigsen
Copy link
Contributor Author

astigsen commented Oct 9, 2015

How should this be prioritized? 1.0?

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).

I think this depends on arrays of primitives and/or a clearer definition of equality between objects.

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).

@bmunkholm bmunkholm added P3 and removed pending labels Oct 26, 2015
@jpsim
Copy link
Contributor

jpsim commented Aug 30, 2016

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.

@jpsim
Copy link
Contributor

jpsim commented Aug 30, 2016

Actually, see this PR instead: realm/realm-tasks#180

@ivnsch
Copy link

ivnsch commented Apr 1, 2018

Any news about this? In Realm-Java, btw, there's a lot of interest in this feature realm/realm-java#759

@roberhofer roberhofer self-assigned this Jun 13, 2018
@cmelchior
Copy link
Contributor

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.

@ironage
Copy link
Contributor

ironage commented Dec 17, 2018

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

@sync-by-unito sync-by-unito bot closed this as completed Sep 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants