title: RESTful API sorting dilemma
body: <p>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</p>
  
  <p>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..</p>
  
  <p>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.</p>
  
  <p>But what happens when you need sorting?</p>
  
  <p>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.</p>
  
  <p>You can't really tell the   /car/5   to sort by username cause it only knows of user ids...</p>
  
  <p>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.</p>
  
  <p>Thanks for any pointers</p>