Hi folks I have REST api implemented following the principle that rest just gives back the basic documents and refs in those documents howto get other things etc etc
For example a /car/5 will give me model:blabla , user_id: 1 and then if you need the owner you'll get /user/1 to get user data..
This way JOINS and stuff are avoided in DB..all things are linking between themselves and data interconnected on rest client part - keeping things simple easy to cache/drop cache, scale etc.
But what happens when you need sorting?
Imagine we have some view on frontend to display following data: Car model, User name, etc... and you wanna sort by user name for example.
You can't really tell the /car/5 to sort by username cause it only knows of user ids...
One option I see is sorting from user /user/list?sortby=username and then interconnecting which of those returned ids actually refer to car. but this means we need to get ALL users..and only use fraction of those which seems killer performance bottleneck.
Thanks for any pointers