Back

Uploading a doc with relationship attribute

  • 0
  • Databases
  • Flutter
  • General
frankenstein
29 Feb, 2024, 14:43

Ive setup relationships in my colllection and its working well with. So how do i fill the relationship attribute from the client side when uploading the document?

TL;DR
When uploading a document with a relationship attribute, even if you have just one relation, it needs to be in a list format. You can reference an existing document by ID or create new documents using a nested format to establish relationships at the same time. Follow the instructions provided in the Appwrite documentation for creating relationships in collections.
Ryan
29 Feb, 2024, 14:48

If the document you want to create the relationship with already exists then you can just reference the ID of that document, or you can create new documents using a nested format to create the documents you want to have the relationship with at the same time https://appwrite.io/docs/products/databases/relationships#create-documents

frankenstein
29 Feb, 2024, 14:57

so its a collection_id: doc_id

frankenstein
29 Feb, 2024, 14:57
TypeScript
        '<REVIEW_ID_1>',
        '<REVIEW_ID_2>'
    ]```
frankenstein
29 Feb, 2024, 14:58

it has to be a list even if i have one relation

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more