Skip to content
Back

redundancy in relationship attribute

  • 0
  • Databases
  • Web
  • Storage
Arti Gaund
26 Dec, 2023, 10:42

I have 2 collection productContent and skills, Both the collection have relationship attribute of each other. I want productContent should contain array of skill's id and skills collection should contain array of product id's. for productContent its working fine, it storing array of skills id, but skills collection is adding redundant data. I am using 2 way many to many relationship

TL;DR
The user is experiencing an issue with redundancy in relationship attributes.
Ernest
26 Dec, 2023, 11:38

Where are the redundant data? Do you mean the item[1] that's displayed? If so I don't think it's redundant data that's just how relationship data is displayed sometimes. To make sure though, check the details of each record and verify that it's indeed redundant data.

Arti Gaund
26 Dec, 2023, 11:48

no i don't want technology to have repeated values

Arti Gaund
26 Dec, 2023, 11:48

technology => [list of product id's]

Arti Gaund
26 Dec, 2023, 11:51

as these productContent have stored the value.

ideclon
26 Dec, 2023, 16:28

Do you mean you don’t want it to be possible to add multiple records to Skills with the same technology field? So in your example screenshot, you have two reacts records?

Arti Gaund
26 Dec, 2023, 16:36

yes

ideclon
26 Dec, 2023, 16:43

You can create an Index with a type of “Unique”, and select “technology” for the Attribute. Then, attempting to create a new Document with the same technology as one already there will fail

Arti Gaund
26 Dec, 2023, 16:53

oh got it, i will try it

Arti Gaund
26 Dec, 2023, 17:00

it wont even adding value in productContent by this.

ideclon
26 Dec, 2023, 17:10

Not sure what you mean by this?

Arti Gaund
26 Dec, 2023, 17:17

i have 2 collections productContent and skills. productContent has relationship attribute with skills collections, it store skills => [list of skills id's] (this was working fine, it was adding the skills id's from skills collection). skills collection also have relationship attribute with productContent collections, it should store productContent => [list of project id's], its not storing the unique technology, technology are getting repeated in the collections. As you suggested to include Index with unique type, I did that, now if the project is having any existing skills/technology, it neither adding in productContent collection nor in skills collection. I just want to do, in productContent collection should have relationship attribute with skills collection and will store skills id (skills=>[skillId1, skillId2...] and skills collection should have relationship attribute with productContent collection and store product id (productContent => [productid1, productId 2...]

Arti Gaund
26 Dec, 2023, 17:20

Like this in productContent { "title": "Product Title", "profileImage": "image_url.jpg", "uploadDate": "2023-01-01", "updateDate": "2023-12-25", "skills": [ "skillId1", "skillId2", "skillId3" ] }

Arti Gaund
26 Dec, 2023, 17:21

In skills collection { "skillId1": { "technology": "Technology 1" "productContent": ["productId1", "productId2"] }, "skillId2": { "technology": "Technology 2" "productContent": ["productId2", "productId3"] }, ... }

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more