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
- MongoDb Database Breaks integer[] & bigi...
I've got a table with the below column created. When I try to insert the value `[-3408048000]` into it, the dart sdk cloud function call is successful (no error...
- Missing Invoice
Hi! I need help with billing on my account (marelu@gmail.com). I have never received a single invoice by email. My organization has been on the Pro plan since...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...