
Hi, I am trying to get hold of using relationships with Python SDK (appwrite 1.3.7). I was successfully able to create and retrieve the documents. However I am having problems with updating the created document. If I don't pass the $id
attribute along with the child payload, duplicates are being created. If I pass $id
along with the payload it results in user unauthorised to perform this action error
. Passing only IDs as an array works as expected but what if these child documents also has some updates? Do we have to update them separately and update the parent ?
Please note the user creating the documents has read/update/delete permission on both parent and child.
The relation is many to many.

weird..you should only get that error if the user doesn't have access to the child document.... you definitely need to include $id
in the nested JSON..

what's your code (the one with the nested $id)?

@Steven I am following the same example as in the docs
await databases.updateDocument(
'marvel',
'movies',
'spiderman',
{
title: 'Spiderman',
year: 2002,
reviews: [
{$id: <doc_id>, author: 'Bob', text: 'Great movie!' },
{ $id: <doc_id>, author: 'Alice', text: 'Loved it to the core!' },
{ author: 'Dave', text: 'Wonderful movie!' }
]
}
);
Here the third review is the new one and the other two are old reviews that were created when the document was created. The text
field has been updated in the existing child documents.

Ya I would expect that to work...

What are the permissions on the 2 collections?

Same as the parent

Screenshot please?

They were created along with the parent in the createDocument call.

On mobile, will share the screenshots and Python code in sometime. Thanks
Recommended threads
- Having errors migrating to cloud
Project will not migrate compeltely
- 2 Columns still processing since yesterd...
Hey o/ Yesterday (around <t:1758045600:f>), I created a database and added several columns to it. After about 15 minutes, most of the "processing" tags disappe...
- 503 Timeout when Updating or Upserting D...
Hey I’m running into an issue when trying to update or upsert a row in Appwrite. The request hangs for a while and then throws this error: ``` AppwriteException...
