Back

Create document with relations, if error can result in orphan relation document

  • 1
  • Databases
  • Tools
Horsty - Cyril (he/him)
28 Mar, 2024, 20:41

Hey, little question, about foreign relationship. How do you deals with orphan when a create document failed ?

I try to upload a lot of data to appwrite cloud, so i loop over my parsed json, and sometimes i have issue (like a new attribute that i don' know or a something else) that leads to an error of the creating document, but foreign key can have be created. And after that i have very hard to find orphans in my collection

Thanks ๐Ÿ™‚

i use sdk node-appwrite

TL;DR
Developers discussing creating documents with relations and handling orphan relation documents to avoid errors. A suggestion to mark the post as closed once the issue is resolved. Also, a reminder to manually iterate over the collection to find orphaned documents as querying is not supported.
Steven
5 Apr, 2024, 15:33

You might have to manually iterate over the collection to find them because querying is not supported ๐Ÿ˜•

Horsty - Cyril (he/him)
5 Apr, 2024, 15:57

Yes =\ I have change how to insert my data and donโ€™t use relationship

Horsty - Cyril (he/him)
5 Apr, 2024, 15:57

I insert a foreign key in the related documents

Horsty - Cyril (he/him)
5 Apr, 2024, 15:58

So i can handle orphan in the script before insert and everything is working

ideclon
14 Apr, 2024, 19:00

If your issue has been solved, you can mark this post as closed by adding "[SOLVED]" to the beginning of the title

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