I want to be able to access 4th child of a main object that are in a relationship. I am able to retrieve upto the third child. I read the docs and there it stated that the relationship were limited upto 3 level nesting but I was wondering if there is a way to overcome this??
Hello, I make a listdocuments call to get the 4 document with the $id of its parent and then I update the state with the document obtained
I don't think that worked.
{
"total": 1,
"documents": [
{
"year": "020",
"department": "cse",
"group": "ab",
"$id": "644bc5e99e493ea3b6e6",
"$createdAt": "2023-04-28T13:11:05.649+00:00",
"$updatedAt": "2023-04-29T10:09:47.482+00:00",
"$permissions": [],
"semester": [
{
"name": "fifth",
"$id": "644bc5e0e205c327a4f6",
"$createdAt": "2023-04-28T13:10:56.926+00:00",
"$updatedAt": "2023-04-29T10:09:47.494+00:00",
"$permissions": [],
"routine": [
{
"weekDay": "sunday",
"$id": "644bc5d31eab2e562140",
"$createdAt": "2023-04-28T13:10:43.126+00:00",
"$updatedAt": "2023-04-29T10:09:47.510+00:00",
"$permissions": [],
"$databaseId": "6447916e7fd0bb75c420",
"$collectionId": "644bc4d36be4d59b861c"
}
],
"$databaseId": "6447916e7fd0bb75c420",
"$collectionId": "644bc4c64c253bb83009"
}
],
"$databaseId": "6447916e7fd0bb75c420",
"$collectionId": "644bc49a8f923016fd61"
}
]
}
i have the relations setup as Class -> Semester -> Routine -> Period
Is there an image i can rollback to when it wasn't deprecated?
yes work for me
` static Future<CerdosModel?> getByCamada(String id) async { try { DocumentList json = await databases.listDocuments( databaseId: AppWrite.dbId, collectionId: AppWrite.cerdosCollectionId, queries: [ Query.equal("camadas", id), ], );
return CerdosModel.fromJson(json.documents.first.data);
} catch (e) {
return null;
}
}`
` CerdosModel? cerdos = await CerdosEndpoint.getByCamada(camada.$id!); camada.cerdos!.add(cerdos!); cerdos.camadas = camada;
pecerasController.peceras
.firstWhere((element) => element.$id == cerdos.corralesEngorde!.$id)
.cerdos!
.first = cerdos;`
Example with getx
Im obtain the 4th document "cerdos" with $id of the document 3 "camadas"
Not really. The limit was always supposed to be 3
isnt 3 like too low??
I don't think so 🤷♂️
aight fair
but is there a way to tackle it
You can tweak the code. Or change your client side code to fetch the necessary related data
or should i use queries lile hortigado suggested?
That was my 2nd suggestion
I will try that then Thanks for your help🤗
Recommended threads
- Relations within the same table
Hello, I'm currently building a sort of dictionary (a literal one) and thus I need words (which is one single table of words in my database) to be able to have ...
- [SOLVED] Query.search() returning all ro...
When I use Query.search() instead of returning rows with the keywords provided it just returns all the rows in the table.
- 1:1 relationship doesn’t sync after re-a...
Hi, I’m trying to use a two-way one-to-one relationship. It works fine when I create a record with the relationship set, and it also works when I unset it. But ...