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
- appwrite pull Tables duplicates all coll...
I encountered a bug when running appwrite pull Tables. Every existing collection in my appwrite.json gets duplicated. One collection ended up appearing three t...
- 1.6.2 to 1.7.0
Hi everyone. I am running a self-hosted Appwrite server on version 1.6.2. What is the safest way to migrate to the next version? Should I update directly to...
- Exception: Route not found when calling ...
I have self-hosted v1.8.1 and I am using an Appwrite function with node-appwrite v22. When I call the createVarcharColumn() in my server function I get this exc...