
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
- Problems with adding my custom domain
- CSV Not Importing
We don’t seem to having any luck importing a simple .csv file. The import function acts like it’s working but no data imports or is shown in the collection The...
- Can't push functions when self-hosting o...
Hello, I'm a bit new to appwrite functions and recently hosted a fresh 1.7.4 on my portainer setup. Tried to create a new function and when trying to push it I ...
