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
- Realtime for files() works almost well, ...
I have been trying to make use of realtime, today (14.03.26) I have pulled all the latest versions of docker images, and sdk available. Whats working: - Conn...
- Function issue
Hi,idk whats wrong with my function but i made some changes to the env var and made sure they saved then i redeployed it,but then after it redeeployed it asked ...
- Function issue
Hi,idk whats wrong with my function but i made some changes to the env var and made sure they saved then i redeployed it,but then after it redeeployed it asked ...