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
- endpoint variable
Appwrite Sites passes e.g. APPWRITE_SITE_API_ENDPOINT to the site, but i need this variable in Next.js in my Client-Side-Page. How can i pass it? Next.js only p...
- support counts
I want just want number of rows i have matching few conditions, if databse.count was there then will had saved few resources, instead using databse.listrows
- How can I get the Google Avatar of the u...
How can I get the Google Avatar of the user that signed in with Google?