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
- is `account.get()` safe to be used in th...
I want to user's `id` for authentication. However, a while ago I was told in this server not to use `account.get()` and instead add user preferences for that us...
- Appwrite console is too heavy
The Appwrite console is too heavy And all of my services broken Any support , please
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...