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?
yep. For example, that the current 3rd value is becoming the 2nd.
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
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.
Recommended threads
- Upgrading selfhost version?
It is okay to upgrade version to higher one, of my current version is 1.7.4 to 1.8.1. Is that safe to do cause my clients already have data on that? Also is a...
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...
- Appwrite cloud DB server error 500
Getting this error