Hi! I have a two-way relationship, 1-1, in appwrite. The two collections are "page" and "metadata". I have just created the new table (metadata table) and added the relationship, so currently, all the values for the relationship in the page table are null + there are no documents in the metadata table (obviously).
But I don't want that. I want that every page has a relationship to metadata. That's why I am currently creating a migration script, and one of the lines look like this:
final metadataResponse = await _database.updateDocument(
databaseId: AppEnv().accommodationDatabaseId,
collectionId: AppEnv().pageCollectionId,
documentId: pageId,
data: {
'metadata': {
'visibleAtCheckIn': false,
'visibleAtCheckOut': false,
'titleImage': null,
},
},
);
Essentially, I create the metadata through the page collection. This works kinda great. It creates the new metadata document, and the metadata attribute in the page table is filled with the id of the newly created metadata. But as already said, I have a two way relationship. The problem is that currently, the "page" attribute in the metadata table is still n/a, even though "metadata" in the page table is filled.
This also does not work:
final metadataResponse = await _database.createDocument(
databaseId: AppEnv().accommodationDatabaseId,
collectionId: AppEnv().pageMetadataCollectionId,
documentId: ID.unique(),
data: {
'visibleAtCheckIn': false,
'visibleAtCheckOut': false,
'titleImage': null,
'page': pageId,
}
As I get this error: TypeError: Instance of 'JSArray<dynamic>': type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>'
So my question is: How can I create the metadata documents and have a bug-free relationship?
Recommended threads
- general_route_not_found - Auth Guide
If you’ve just added a subdomain to your project, verified your DNS records, and confirmed your SSL certificate is working, but you're still hitting a `general_...
- Can't resume paused project
I have logged in in incognito, done the email verification and still get the invalid fingerprint error. What's the issue.
- Download appwrite Docs
Is there is a way to download appwrite Docs ? Because appwrite skill isn't enough to give the agent full understanding about how appwrite works (I noticed this ...