
Hi, I am not sure if it's a bug or I did not really see through the new collection relations.
I have e.g. a collection holding reservations
for a boat ride from a to b. I also have a ports
collection and would need to have a portsfrom
field referencing a port
in reservations
. So far so easy. That works!
Now I add another field that references the destination portsto
in the same way and that keeps failing.

would you please provide more detail on the attributes including one/two way and the attribute keys?

Oh, sure⦠since every Reservation holds one reference to a Departure Port and one reference to a Destination Port I assume it is a many to one relation and it needs only to be one Way since the Ports dont need to store what Reservations they have. I provided a screenshot originally here https://discord.com/channels/564160730845151244/564160731327758347/1152573015201157170 but then forgot to copy it here https://cdn.discordapp.com/attachments/564160731327758347/1152573014735597618/Screenshot_2023-09-16_at_13.48.51.png

The firt setup was exactly the same only the Attribute Key was different Β΄portfromΒ΄. That first one was created well. https://cdn.discordapp.com/attachments/564160731327758347/1152573014978875452/Screenshot_2023-09-16_at_13.47.33.png

ah very interesting...would you be able to create an issue and include this info in the issue?
The problem is a many to one relationship requires adding a column/attribute in the related collection. by default, the column/attribute key would be the source collection. however, the 2nd relationship would have the same column/attribute key causing the error

if you use a two way relationship, you'll be able to configure the column/attribute key in the related collection, making it different, so they don't conflict

sure I will post the issue and try using a two way relation for the 2nd Port
reference. Thanks for looking into this!

@Steven I tried the two-way-relation
β unfortunately it does not work either. Also I raised the github issue

Uh this is many to many now...

π΅βπ« It's just not my day today ...

would you please check the docker logs in the appwrite-worker-databases for this one?

Ok, first it works with many to one
. <:appwriteparty:946072712915341333>

Here's what happens when I try to create the second Attribute: Like so?

And this when I add the 2nd field in a many-to-many relation:

you mean only creating the 1st attribute works?

or did you mean these logs are from when you tried creating the one-way many to one?

ok we should treat this as a separate issue: Unable to create multiple many to many relationships between the same collections

π My real life Problem is solved using your approach (Many-to-One in a two way Relationship wher I have PORTSFROM in Reservations related to RESERVATIONSTOHERE in the Ports Collection. The second field setting PORTSTO and RESERVATIONSTOHERE also works.

The first log is when I repeat the initial problem.

The second log is from the many-to-many issue. I can rais this on GitHub tomorrow separately.

Both attributes are two-way , many to one and their Attribute key of related collection is same ?

I deleted them and readded them for logging purposes

FYI, the related issue: https://github.com/appwrite/appwrite/issues/6281
Make sure you ππΌ
Recommended threads
- Invalid relationship value. Must be eith...
I'm getting this error when i try to update a document. The collection has a relatipship with 2 other collections. I don't understand why, when i update the doc...
- How do I do this. Please help!
Hey guys! Okay AI can't help so I'm asking real people now. π Anyway I wanted to know how one solve this in Appwrite right now. So I have a form where I wante...
- Delete account on authentication
I'm building an authentication that need to a user a choice of delete their account when they need and on the documentation, if I find delete sessions or sessio...
