Ran into this bug. When I did an update of the document in the collection, I mistakenly passed other id to the relationship attribute. After that I won't be able to clear that attribute into an empty array. these undefined fields in the array remained all the time, and after I add right ids. You can see it in the pictures below. Only deleting the document helped
Interesting...was it still there after refreshing the page?
Yes
I cant delete them from ui too
I'll try now to reproduce and refresh the whole page
interesting...from my experience, the relationship doesn't save if the document ID doesn't exist 🧐
I did a repeat. Yes, undefined again. and I sent not ids but an array of strings (I mixed up the arrays when this first happened)
@Steven I can send to you video, how it works. When I try delete, after that window freeze, and I refresh window
array of strings? What od you mean exactly? and can you share the JSON response for the get document api call for this document?
JSON:
{ "user_id" : "6477728b7ed36c3d3b05", "$id" : "6477728bbbc03f383897", "device_id" : null, "deleted" : false, "background" : null, "$createdAt" : "2023-05-31T16:15:07.769+00:00", "$updatedAt" : "2023-05-31T16:21:21.672+00:00", "$collectionId" : "644ccfb5873757ec93fa", "active_status" : false, "phone" : null, "chatRooms" : [
], "nick_name" : "testA", "created_by" : "64763abdbfa4ab03e718", ||"role_id" : [ { "$collectionId" : "6450c122e4cc1bf2e41a", "$databaseId" : "644ccfacafd0a0087649" }, { "$collectionId" : "6450c122e4cc1bf2e41a", "$databaseId" : "644ccfacafd0a0087649" } ],|| "first_name" : "first", "$databaseId" : "644ccfacafd0a0087649", "team_id" : "646e0dad7c68c11a09ba", "$permissions" : [
] }
const update_user = await database.updateDocument(db_id, db_users_id, user_document_id, {'team_id':payload.team_id, 'role_id':role_ids, "updated_by":by_user});
role_ids: ["645e5f3f1e810c950493", "644ccfb5873757ec93fa"] must be like this, but was by mistake role_ids: ["admin","manager"]
@Steven
Attribute role_id is Relationship (many to many)
make sure to use 3 back ticks for multi line code
ah that was it...
would you please create an issue for this and include all this info?
we need to check and verify the document exists before doing this step: https://github.com/utopia-php/database/blob/d821d1f18dfe83b0350ed208be3658764aec99d7/src/Database/Database.php#L3212-L3224
Yes, of course I will do it tomorrow
Recommended threads
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...