i'm trying to transfer my subcollections data in my firebase firestore data to appwrite
with a new logic that appwrite cloud support
What is the data structure of documentData
it's different from subcollection to subcollection, anyway this is an example:
first subcollection
{
"date": "2024-05-08",
"city": "xx",
"imageURl": "https://cdn.discordapp.com/attachments/xxxxx",
"name": "xxxx",
"id": "xx",
"age": "xx",
"firestoreId": "1197596471621599302"
},
second:
{
"bankAmount": 10001500,
"blocked": false,
"cashAmount": 0,
"id": "xxxx",
"firestoreId": "1027912017685782600"
},
and another two subcollections that looks something like this
I don't believe you would use the collectionId for the relationship, you would use the attribute name.
firestoreId = document id in firestore
yh i did
you can check:
switch (appwriteCollectionId) {
case 'bank':
relationshipData = 'activeUsers'
continue;
case 'active_users':
relationshipData = 'activeUsers'
continue;
case 'police_penalties':
relationshipData = 'policePenalties'
continue;
case 'ids':
relationshipData = 'iDs'
continue;
}
alright, because in the code it says relationshipData = appwriteCollectionId
ah I see that now, didn't go far enough down
on line 383, can that document you're updating have multiple relationships?
yh
it has relationship with all other subCollections
as i said it's 4 subcollections that were in my firestore data
this is why i handled the switch logic
Make docId an array of one
If the relationship is many, I believe it has to be an array. If it's just one to one then it's a string of the id.
i'll try
as all of them are one-to-many
also i wanna ask if i'm not gonna annoy you, i'm using Two-way relationship -> "one-to-many" with On deleting a document = CasCade
do this mean if i deleted a document inside the related collection is going to delete the main one?
if you delete the parent it will delete the children
and if i deleted the child?
as i'm using Two-way relationship not one way
Recommended threads
- CORS preflight returns 500 on Dart funct...
Hey everyone π Iβm running a Dart cloud function, Every time I respond to a preflight (OPTIONS) request, I get a 500 internal error, and the logs show: ```NoSu...
- Auto Updating Backend & Auth via Appwrit...
<@870607367597850624> Hey everyone π I wanted to ask to ask for a friend, heβs asking if Appwrite be used in a similar way to Supabase when integrated with AI ...
- execution failed
When executing an appwrite function, I'm getting a 500 error, but I don't see it in executions. This issue appeared today. Here's the appwrite function ID: 68b4...