Back

[Solved] Getting general_unknown error while updating document relationship.

  • 0
  • Databases
  • Flutter
  • Cloud
james54
9 Nov, 2023, 08:56

I have two collections Match & Score with one-to-one two way relationship. I am able to create Match document with nested score document perfectly fine (The link between Match to Score is working) When i fetch the score document i am not able to get the match document because Score to Match link is not present.

So i thought i have to create the Score to Match link manually. Now when i try to create link by updating score document with match document id inside of it. appwrite is throwing general_unknown error. I am stuck because i don't know how to debug this situation.

I have provided screenshot of my code, It is throwing error when i try to update score document. The update Match document call is working fine.

TL;DR
The user was experiencing a general_unknown error while trying to update a document relationship. They had two collections with a one-to-one relationship and were able to create the Match document with a nested Score document. However, when trying to fetch the Score document, they were not able to get the Match document because the Score to Match link was not present. They tried manually creating the link by updating the Score document with the Match document ID, but this caused the general_unknown error. The user provided a screenshot of their code. The thread ended with a comment saying that Relationships might not be stable yet.
Mosh Ontong
9 Nov, 2023, 14:18

Correct me If I am wrong:

You try to get the Score Document but there is no data for Match linked on this specific document?

james54
9 Nov, 2023, 14:33

Yes exactly and it will be not there obviously because in appwrite console that score document's match field is empty.

So i thought that i need to set it now if i try to set it using above code i am getting general_unknown exception

Mosh Ontong
9 Nov, 2023, 14:35

The problem could be Permission Security related

Mosh Ontong
9 Nov, 2023, 14:36

You have to enable the create permission on the Collection Level

Mosh Ontong
9 Nov, 2023, 14:37

Then the other permission such as read, update and delete you can enable it either Collection or Document level it depends on you

ideclon
9 Nov, 2023, 15:32

Also, I don’t think Relationships are fully stable yet? Might not be your fault at all.

james54
9 Nov, 2023, 16:01

I have checked permission in both collections ,I have given all permission to all users of the app for both the collections ,i think it should work and not have to be a permission issue.

Drake
10 Nov, 2023, 19:09

What's your project ID?

james54
12 Nov, 2023, 14:27

6505612ba995ac771cdd

Drake
12 Nov, 2023, 22:11

Match is a one to one? If so, you should not be passing an array 🧐

james54
13 Nov, 2023, 03:56

Thank you @Steven for this, I tried to do this previously but it was not working (Maybe due to some error from my side) Now it is working fine.

james54
13 Nov, 2023, 05:40

[Solved] Getting general_unknown error while updating document relationship.

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