Rank 2: Process
Appwrite relationships are great. I have a relationship with one to many. So one Document stores multiple ids. But is there a way to (programatically) reorder this list?
Votes
1
Replies
9
Participants
Unknown
Messages
10
Rank 2: Process
Appwrite relationships are great. I have a relationship with one to many. So one Document stores multiple ids. But is there a way to (programatically) reorder this list?
Not sure what exactly you mean. Do you want to re-order the way they're returned?
Rank 2: Process
yep. For example, that the current 3rd value is becoming the 2nd.
Rank 2: Process
So you want to keep the order of the relationships the way they are inserted? Or if you edit them from the other side into:
artictleBlocks: [id1, id2, id3], to have them returned in that order? And if you add a new block id4 that is linked to the Article to be added at the end, resulting in id1, id2, id3, id4?
I'm not sure of how relations fully work, but I'm pretty sure that the order of the IDs in the relationship are chronological. So whenever a child is created, it gets attached to the end of the list. I'd like to assume that's the expected behaviour, as you can filter/sort your lists on the client side
Rank 5: Hypervisor
why would you like to do it? order generally doesn't have any impact
Yeah, they are returned based on their creation time. I was testing it now.
I guess he wants to keep them in his defined order, without needing a special attribute for it such as having on each ArticleBlocks attribute int order.
Aha that makes sense. @Tomic R. you should look at this idea of using an integer attribute order to help you sort them better.