{"action":"closed","issue":{"url":"https://api.github.com/repos/platanus/angular-restmod/issues/228","labels_url":"https://api.github.com/repos/platanus/angular-restmod/issues/228/labels{/name}","comments_url":"https://api.github.com/repos/platanus/angular-restmod/issues/228/comments","events_url":"https://api.github.com/repos/platanus/angular-restmod/issues/228/events","html_url":"https://github.com/platanus/angular-restmod/issues/228","id":53307337,"number":228,"title":"How to efficiently save a collection (why no save())?","user":{"login":"ronaldjeremy","id":1102583,"avatar_url":"https://avatars.githubusercontent.com/u/1102583?v=3","gravatar_id":"","url":"https://api.github.com/users/ronaldjeremy","html_url":"https://github.com/ronaldjeremy","followers_url":"https://api.github.com/users/ronaldjeremy/followers","following_url":"https://api.github.com/users/ronaldjeremy/following{/other_user}","gists_url":"https://api.github.com/users/ronaldjeremy/gists{/gist_id}","starred_url":"https://api.github.com/users/ronaldjeremy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronaldjeremy/subscriptions","organizations_url":"https://api.github.com/users/ronaldjeremy/orgs","repos_url":"https://api.github.com/users/ronaldjeremy/repos","events_url":"https://api.github.com/users/ronaldjeremy/events{/privacy}","received_events_url":"https://api.github.com/users/ronaldjeremy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-03T15:54:27Z","updated_at":"2015-01-07T01:27:28Z","closed_at":"2015-01-07T01:27:28Z","body":"Say I have a bikes collection consisting of 30 bikes.  In my application the bikes are listed and the user can drag-n-drop the bikes up or down in the list to sort them to their liking.\r\n\r\nEach bike has \"sortpos\" property to indicate its position in the list.  If a user drags the bike in position 1 down to position 30, it now has sortpos 30 and every bike before it will have their sortpos shifted by -1.\r\n\r\nMy question is, how can I handle $save()'ing all of this to the server without generating 30 PUT requests that flood the server and slow the app?  It seems like I should be able to do a single \"bikes.$save()\" PUT to \"/bikes\" with the body being an array like [{id:1,sortpos:30},{id:2,sortpos:1},{id:3,sortpos:2}...] -- (instead of 30 separate \"bike.$save()\" PUTs to \"/bikes/id\" {sortpos:pos})  ?"}}