{"action":"created","issue":{"url":"https://api.github.com/repos/SkygearIO/skygear-SDK-JS/issues/22","repository_url":"https://api.github.com/repos/SkygearIO/skygear-SDK-JS","labels_url":"https://api.github.com/repos/SkygearIO/skygear-SDK-JS/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/SkygearIO/skygear-SDK-JS/issues/22/comments","events_url":"https://api.github.com/repos/SkygearIO/skygear-SDK-JS/issues/22/events","html_url":"https://github.com/SkygearIO/skygear-SDK-JS/issues/22","id":162597091,"number":22,"title":"Update and Delete API is confusing","user":{"login":"TakLee96","id":5365444,"avatar_url":"https://avatars.githubusercontent.com/u/5365444?v=3","gravatar_id":"","url":"https://api.github.com/users/TakLee96","html_url":"https://github.com/TakLee96","followers_url":"https://api.github.com/users/TakLee96/followers","following_url":"https://api.github.com/users/TakLee96/following{/other_user}","gists_url":"https://api.github.com/users/TakLee96/gists{/gist_id}","starred_url":"https://api.github.com/users/TakLee96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TakLee96/subscriptions","organizations_url":"https://api.github.com/users/TakLee96/orgs","repos_url":"https://api.github.com/users/TakLee96/repos","events_url":"https://api.github.com/users/TakLee96/events{/privacy}","received_events_url":"https://api.github.com/users/TakLee96/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-06-28T03:53:36Z","updated_at":"2016-06-29T09:42:01Z","closed_at":null,"body":"To Update:\r\n``` javascript\r\nlet query = new skygear.Query(Note);\r\nquery.equalTo('_id', '123456...');\r\n\r\nskygear.publicDB.query(query)\r\n.then((records) => {\r\n  let note = records[0];\r\n  note['content'] = 'Hello New World';\r\n  return skygear.publicDB.save(note);\r\n}).then(...);\r\n```\r\n\r\nTo Delete:\r\n``` javascript\r\nskygear.publicDB.delete({\r\n  'id': 'note/123456...'\r\n}).then(...);\r\n```\r\n\r\nIt is confusing that Update API uses `_id` but delete API uses `id`. Also, if I try to use `id` for update, then there is 500 internal server error saying column `note.id` does not exist; if I try to use `_id` for delete, there is 400 bad request error saying `_id` should be of format '{type}/{id}' got \"\"."},"comment":{"url":"https://api.github.com/repos/SkygearIO/skygear-SDK-JS/issues/comments/229308508","html_url":"https://github.com/SkygearIO/skygear-SDK-JS/issues/22#issuecomment-229308508","issue_url":"https://api.github.com/repos/SkygearIO/skygear-SDK-JS/issues/22","id":229308508,"user":{"login":"cheungpat","id":170071,"avatar_url":"https://avatars.githubusercontent.com/u/170071?v=3","gravatar_id":"","url":"https://api.github.com/users/cheungpat","html_url":"https://github.com/cheungpat","followers_url":"https://api.github.com/users/cheungpat/followers","following_url":"https://api.github.com/users/cheungpat/following{/other_user}","gists_url":"https://api.github.com/users/cheungpat/gists{/gist_id}","starred_url":"https://api.github.com/users/cheungpat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cheungpat/subscriptions","organizations_url":"https://api.github.com/users/cheungpat/orgs","repos_url":"https://api.github.com/users/cheungpat/repos","events_url":"https://api.github.com/users/cheungpat/events{/privacy}","received_events_url":"https://api.github.com/users/cheungpat/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T09:42:01Z","updated_at":"2016-06-29T09:42:01Z","body":"@rickmak is it possible to create a record field called `id`?"}}
{"actor":{"display_login":"cheungpat"}}