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
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...