{"action":"created","issue":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/1226","labels_url":"https://api.github.com/repos/keystonejs/keystone/issues/1226/labels{/name}","comments_url":"https://api.github.com/repos/keystonejs/keystone/issues/1226/comments","events_url":"https://api.github.com/repos/keystonejs/keystone/issues/1226/events","html_url":"https://github.com/keystonejs/keystone/pull/1226","id":62510782,"number":1226,"title":"Add exclude option to UpdateHandler","user":{"login":"ttsirkia","id":2797729,"avatar_url":"https://avatars.githubusercontent.com/u/2797729?v=3","gravatar_id":"","url":"https://api.github.com/users/ttsirkia","html_url":"https://github.com/ttsirkia","followers_url":"https://api.github.com/users/ttsirkia/followers","following_url":"https://api.github.com/users/ttsirkia/following{/other_user}","gists_url":"https://api.github.com/users/ttsirkia/gists{/gist_id}","starred_url":"https://api.github.com/users/ttsirkia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ttsirkia/subscriptions","organizations_url":"https://api.github.com/users/ttsirkia/orgs","repos_url":"https://api.github.com/users/ttsirkia/repos","events_url":"https://api.github.com/users/ttsirkia/events{/privacy}","received_events_url":"https://api.github.com/users/ttsirkia/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/keystonejs/keystone/labels/(status)%20needs%20review","name":"(status) needs review","color":"cb137f"},{"url":"https://api.github.com/repos/keystonejs/keystone/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-03-17T20:32:16Z","updated_at":"2015-03-26T09:38:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/keystonejs/keystone/pulls/1226","html_url":"https://github.com/keystonejs/keystone/pull/1226","diff_url":"https://github.com/keystonejs/keystone/pull/1226.diff","patch_url":"https://github.com/keystonejs/keystone/pull/1226.patch"},"body":"The main reason for this PR is to make `UpdateHandler` more usable in own code. If there are many fields in the model, blacklisting fields may be easier than whitelisting the wanted fields. This PR adds a new option `exclude` to achieve this.\r\n\r\nThere are two ways to use the option:\r\n\r\n```javascript\r\nupdater.process(newData, {exclude: 'user, createdAt'}, function(err) {\r\n```\r\n\r\n```javascript\r\nupdater.process(newData, '-user, -createdAt', function(err) {\r\n```\r\n\r\nIf a string is passed instead of an object and the string starts with a hyphen, the string is considered as the list of fields to be excluded.\r\n\r\nThis PR partially implements #1216. This was the easier part of that and the new field-level option still requires comments and ideas.\r\n"},"comment":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/comments/86422320","html_url":"https://github.com/keystonejs/keystone/pull/1226#issuecomment-86422320","issue_url":"https://api.github.com/repos/keystonejs/keystone/issues/1226","id":86422320,"user":{"login":"ttsirkia","id":2797729,"avatar_url":"https://avatars.githubusercontent.com/u/2797729?v=3","gravatar_id":"","url":"https://api.github.com/users/ttsirkia","html_url":"https://github.com/ttsirkia","followers_url":"https://api.github.com/users/ttsirkia/followers","following_url":"https://api.github.com/users/ttsirkia/following{/other_user}","gists_url":"https://api.github.com/users/ttsirkia/gists{/gist_id}","starred_url":"https://api.github.com/users/ttsirkia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ttsirkia/subscriptions","organizations_url":"https://api.github.com/users/ttsirkia/orgs","repos_url":"https://api.github.com/users/ttsirkia/repos","events_url":"https://api.github.com/users/ttsirkia/events{/privacy}","received_events_url":"https://api.github.com/users/ttsirkia/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T09:38:38Z","updated_at":"2015-03-26T09:38:38Z","body":"So everything works as before, execpt you have a more user-friendly option to select the fields. If you have five fields in your model and want to update only four of them, you can use `field1, field2, field3, field4` as before or simply `-field5` by using this new feature. Nothing else has changed."}}