Hi, I am building a web application that allows the user to change the order of items stored inside a document array attribute.
Now when I pass the new array with updated order then it doesn't work. Appwrite doesn't update the order of array items inside the document.
Also, Please note I am using document relationships.
Document Example.
//User
{
name: "Vishal",
posts: [ //Relationship with a posts collection
"post 1",
"post 2",
"post 3"
]
}
Is there any way I can change the order of posts in the above example?
Unable to change order of items in a document array attribute
You're passing an array of document IDs?
No, i am passing the entire document
Payload and Response Example.
This is an update document API call? Can you copy and paste the JSON here?
Also, can you share the details of the collections so we know all the attribute configurations?
These are the profile collection attributes
I have a unique profile for each user and I am updating the profile everytime anything changes
Links Collection Attributes
I have removed some data like createdAt and UpdatedAt to just have some imp fields
Can you provide the details of the links attribute?
@Steven Please check this
I meant the details of the attribute in the profile collection. So I can see the type of relationship and whatnot
I'll have to try and reproduce this tomorrow
okay so i was sort of able to reproduce the problem...the order was off even when i created the document and the order was incorrect, but it wasn't incorrect the same way yours was...
would you be able to create an issue for the problem?
thank you for opening
Recommended threads
- Does Appwrite allow SSE ?
i'm trying to setup a slack bot on my site. Your deployed SSE endpoint is returning a non‑SSE response …and the browser immediately closes the connection. read...
- The console isnt showing documents
In console ui saved documents are being shown on frontend but i can see its showing 4 or number of docs available but in rows its only showing single doc and th...
- 1.8.1 - Databases - inline updating a ro...
When updating a database field via the inline edit method, the `$updatedAt` column does not get updated. Only if the row is updated by the "Update" interface (t...