Duplicate array objects for cyclic many to many relations
See original GitHub issueI have a many to many relations between two models. When I create 2 level cycle then duplicate objects are added to array. For example suppose I have two models User and Intersts and many to many relation between then like this:
User.schema = {
name: 'User',
primaryKey: 'id',
properties: {
id: { type: 'string', default: '' },
name: { type: 'string', default: '' },
interests: { type: 'list', objectType: 'Interest', default: [] },
}
}
Interest.schema = {
name: 'Interest',
primaryKey: 'id',
properties: {
id: { type: 'string', default: '' },
name: { type: 'string', default: '' },
interestedUsers: { type: 'list', objectType: 'User', default: [] },
}
}
When I try to insert following data with realm.create(<modelName>, <object>, true)
it does that correctly: http://pastebin.com/pE1FFd5x
But on adding following data multiple entries for same interest is created for user: http://pastebin.com/FFLbR5CR
A demo project showing the issue is here: https://github.com/shahankit/realm-duplicate
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Avoid circular reference on many-to-many object relations
Now, circular references can be tricky to deal with if you need to ... You don't instantiate involved entities in the relation object....
Read more >Circular dependency between 2 table with one to one and one ...
Cannot insert duplicate key row in object 'dbo.CompaniesUsers' with unique index 'IX_CompanyUsers'. The duplicate key value is (1, 1).
Read more >Duplicate Any Object Around A Point (Circle) Using An Array ...
Hey guys, in today's tutorial I'm going to be showing you how to quickly and easily create a symmetrical object around a point/circle...
Read more >Working with entity instances — Pony ORM documentation
The relationships between two objects are defined by two relationship attributes. If another side of the relationship is declared as a Set ,...
Read more >Many-to-many relations - Prisma
Explicit many-to-many relations. In an explicit many-to-many relation, the relation table is represented as a model in the Prisma schema and can be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Will hopefully be able to start working on adding virtual properties/backlinks/#343 in the next two weeks.
We now have underlying core and object store support for computed properties and I hope this will make it into one of the next few releases, assuming we don’t run into technical issues in how we expose this functionality in the js layer.