{"action":"created","issue":{"url":"https://api.github.com/repos/cozy/cozy-data-system/issues/126","labels_url":"https://api.github.com/repos/cozy/cozy-data-system/issues/126/labels{/name}","comments_url":"https://api.github.com/repos/cozy/cozy-data-system/issues/126/comments","events_url":"https://api.github.com/repos/cozy/cozy-data-system/issues/126/events","html_url":"https://github.com/cozy/cozy-data-system/issues/126","id":59704411,"number":126,"title":"Bulk update","user":{"login":"bnjbvr","id":1180019,"avatar_url":"https://avatars.githubusercontent.com/u/1180019?v=3","gravatar_id":"","url":"https://api.github.com/users/bnjbvr","html_url":"https://github.com/bnjbvr","followers_url":"https://api.github.com/users/bnjbvr/followers","following_url":"https://api.github.com/users/bnjbvr/following{/other_user}","gists_url":"https://api.github.com/users/bnjbvr/gists{/gist_id}","starred_url":"https://api.github.com/users/bnjbvr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnjbvr/subscriptions","organizations_url":"https://api.github.com/users/bnjbvr/orgs","repos_url":"https://api.github.com/users/bnjbvr/repos","events_url":"https://api.github.com/users/bnjbvr/events{/privacy}","received_events_url":"https://api.github.com/users/bnjbvr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cozy/cozy-data-system/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-03-03T20:58:53Z","updated_at":"2015-03-24T10:53:18Z","closed_at":null,"body":"I see there is an end-point for bulk delete, but not for bulk update. However, the db_remove_helper suggests that it shouldn't be too different to do (as a deletion seems to be actually an update, iiuc). Is there any way we could have a bulk update end-point, please?\r\n\r\nHere's an API i imagine:\r\n```\r\nPUT /request/:type/:req_name/update\r\nParam:\r\n  type: the doctype name\r\n  req_name: the name of the request\r\n  Body {\r\n    key: only returns document for this key\r\n    keys: [only returns document for this array of keys]\r\n    limit: number of documents to return\r\n    skip: number of documents to skip\r\n    startKey: only returns document after this key\r\n    endKey: only returns document before this key\r\n    update: [[key, value], [key, value]] or [key, value]\r\n  }\r\n  The body is fully optional.\r\n```\r\n\r\nFor instance, with\r\n```\r\nbody = {\r\n  update: ['date', '1234']\r\n}\r\n```\r\nThen the 'date' field of all values should be updated to '1234'.\r\n\r\n```\r\nbody = {\r\n  update: [['date', '1234'], ['bankAccount', '4321']]\r\n}\r\n```\r\nThen the 'date' field of all values is updated to 1234, and the 'bankAccount' field of all values is updated to 4321.\r\n\r\nNot sure about the naming of `update`, maybe `values` or `replaceBy` would be more adequate."},"comment":{"url":"https://api.github.com/repos/cozy/cozy-data-system/issues/comments/85448925","html_url":"https://github.com/cozy/cozy-data-system/issues/126#issuecomment-85448925","issue_url":"https://api.github.com/repos/cozy/cozy-data-system/issues/126","id":85448925,"user":{"login":"jankeromnes","id":599268,"avatar_url":"https://avatars.githubusercontent.com/u/599268?v=3","gravatar_id":"","url":"https://api.github.com/users/jankeromnes","html_url":"https://github.com/jankeromnes","followers_url":"https://api.github.com/users/jankeromnes/followers","following_url":"https://api.github.com/users/jankeromnes/following{/other_user}","gists_url":"https://api.github.com/users/jankeromnes/gists{/gist_id}","starred_url":"https://api.github.com/users/jankeromnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jankeromnes/subscriptions","organizations_url":"https://api.github.com/users/jankeromnes/orgs","repos_url":"https://api.github.com/users/jankeromnes/repos","events_url":"https://api.github.com/users/jankeromnes/events{/privacy}","received_events_url":"https://api.github.com/users/jankeromnes/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T10:53:18Z","updated_at":"2015-03-24T10:53:18Z","body":"Interesting idea, thanks @aenario! Actually it might even be faster to store all my values in one single document, since the number of documents seems to be the bottleneck. I'll try different options."}}