{"action":"created","comment":{"url":"https://api.github.com/repos/koopjs/winnow/pulls/comments/181876509","pull_request_review_id":112577877,"id":181876509,"diff_hunk":"@@ -76,9 +79,14 @@ function esriFy (result, options, i) {\n     })\n   }\n \n-  const metadata = (options.collection && options.collection.metadata) || {}\n-  if (!metadata.idField) {\n-    result.attributes.OBJECTID = i\n+  // If the idField for the model set and is not already called OBJECTID, use its value as OBJECTID\n+  if (idField && idField !== 'OBJECTID') {\n+    result.attributes.OBJECTID = result.attributes[idField]\n+    delete result.attributes[idField]","path":"src/executeQuery.js","position":54,"original_position":54,"commit_id":"99162498dc0eeee6947a15ca9929b3686f1c3f32","original_commit_id":"99162498dc0eeee6947a15ca9929b3686f1c3f32","user":{"login":"dmfenton","id":7832202,"avatar_url":"https://avatars1.githubusercontent.com/u/7832202?v=4","gravatar_id":"","url":"https://api.github.com/users/dmfenton","html_url":"https://github.com/dmfenton","followers_url":"https://api.github.com/users/dmfenton/followers","following_url":"https://api.github.com/users/dmfenton/following{/other_user}","gists_url":"https://api.github.com/users/dmfenton/gists{/gist_id}","starred_url":"https://api.github.com/users/dmfenton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmfenton/subscriptions","organizations_url":"https://api.github.com/users/dmfenton/orgs","repos_url":"https://api.github.com/users/dmfenton/repos","events_url":"https://api.github.com/users/dmfenton/events{/privacy}","received_events_url":"https://api.github.com/users/dmfenton/received_events","type":"User","site_admin":false},"body":"Yep, only duplicate if the idField is not called OBJECTID. Make sure to leave some copious notes in the code as to why we're going this route btw.","created_at":"2018-04-16T20:35:06Z","updated_at":"2018-04-16T20:35:06Z","html_url":"https://github.com/koopjs/winnow/pull/68#discussion_r181876509","pull_request_url":"https://api.github.com/repos/koopjs/winnow/pulls/68","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/koopjs/winnow/pulls/comments/181876509"},"html":{"href":"https://github.com/koopjs/winnow/pull/68#discussion_r181876509"},"pull_request":{"href":"https://api.github.com/repos/koopjs/winnow/pulls/68"}},"in_reply_to_id":181748694},"pull_request":{"url":"https://api.github.com/repos/koopjs/winnow/pulls/68","id":181584622,"html_url":"https://github.com/koopjs/winnow/pull/68","diff_url":"https://github.com/koopjs/winnow/pull/68.diff","patch_url":"https://github.com/koopjs/winnow/pull/68.patch","issue_url":"https://api.github.com/repos/koopjs/winnow/issues/68","number":68,"state":"open","locked":false,"title":"Support the use of a provider's idField as OBJECTID and provide alternative if not specified","user":{"login":"rgwozdz","id":4369192,"avatar_url":"https://avatars3.githubusercontent.com/u/4369192?v=4","gravatar_id":"","url":"https://api.github.com/users/rgwozdz","html_url":"https://github.com/rgwozdz","followers_url":"https://api.github.com/users/rgwozdz/followers","following_url":"https://api.github.com/users/rgwozdz/following{/other_user}","gists_url":"https://api.github.com/users/rgwozdz/gists{/gist_id}","starred_url":"https://api.github.com/users/rgwozdz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgwozdz/subscriptions","organizations_url":"https://api.github.com/users/rgwozdz/orgs","repos_url":"https://api.github.com/users/rgwozdz/repos","events_url":"https://api.github.com/users/rgwozdz/events{/privacy}","received_events_url":"https://api.github.com/users/rgwozdz/received_events","type":"User","site_admin":false},"body":"This PR contains following changes:\r\n1. Prevents mutation of a provider's metadata object.  Before this, if a `metadata.idField` had not been set, it was added by winnow and set to OBJECTID. This caused some issues with checking to see if a provider had or had not set the `metadata.idField` for certain code executions.\r\n\r\n2. If an `idField` has been set in the provider, use a feature's value for this property as the OBJECTID. Then delete the `idField` property from the feature's attributes - this prevents sending the same data on two attributes (the idField and the OBJECTID)\r\n\r\n3. If an `idField` has NOT been set in the provider, create an integer hash from the stringified feature and use that as the OBJECTID.\r\n\r\n4. If an `idField` has been set in the provider and is thus used as an OBJECTID, incoming queries that request OBJECTID as  one of the `outFields` need to be remapped to the `idField` so that a proper `SELECT` can occur.\r\n ","created_at":"2018-04-13T20:08:08Z","updated_at":"2018-04-16T20:35:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ff8b4aa19e7ddf3a87f3f8b419b64e0dd2bb5828","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/koopjs/winnow/pulls/68/commits","review_comments_url":"https://api.github.com/repos/koopjs/winnow/pulls/68/comments","review_comment_url":"https://api.github.com/repos/koopjs/winnow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/koopjs/winnow/issues/68/comments","statuses_url":"https://api.github.com/repos/koopjs/winnow/statuses/99162498dc0eeee6947a15ca9929b3686f1c3f32","head":{"label":"koopjs:support-idField-as-OBJECTID","ref":"support-idField-as-OBJECTID","sha":"99162498dc0eeee6947a15ca9929b3686f1c3f32","user":{"login":"koopjs","id":11509517,"avatar_url":"https://avatars2.githubusercontent.com/u/11509517?v=4","gravatar_id":"","url":"https://api.github.com/users/koopjs","html_url":"https://github.com/koopjs","followers_url":"https://api.github.com/users/koopjs/followers","following_url":"https://api.github.com/users/koopjs/following{/other_user}","gists_url":"https://api.github.com/users/koopjs/gists{/gist_id}","starred_url":"https://api.github.com/users/koopjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koopjs/subscriptions","organizations_url":"https://api.github.com/users/koopjs/orgs","repos_url":"https://api.github.com/users/koopjs/repos","events_url":"https://api.github.com/users/koopjs/events{/privacy}","received_events_url":"https://api.github.com/users/koopjs/received_events","type":"Organization","site_admin":false},"repo":{"id":52110344,"name":"winnow","full_name":"koopjs/winnow","owner":{"login":"koopjs","id":11509517,"avatar_url":"https://avatars2.githubusercontent.com/u/11509517?v=4","gravatar_id":"","url":"https://api.github.com/users/koopjs","html_url":"https://github.com/koopjs","followers_url":"https://api.github.com/users/koopjs/followers","following_url":"https://api.github.com/users/koopjs/following{/other_user}","gists_url":"https://api.github.com/users/koopjs/gists{/gist_id}","starred_url":"https://api.github.com/users/koopjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koopjs/subscriptions","organizations_url":"https://api.github.com/users/koopjs/orgs","repos_url":"https://api.github.com/users/koopjs/repos","events_url":"https://api.github.com/users/koopjs/events{/privacy}","received_events_url":"https://api.github.com/users/koopjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/koopjs/winnow","description":"Run SQL queries against GeoJSON without a database","fork":false,"url":"https://api.github.com/repos/koopjs/winnow","forks_url":"https://api.github.com/repos/koopjs/winnow/forks","keys_url":"https://api.github.com/repos/koopjs/winnow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/koopjs/winnow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/koopjs/winnow/teams","hooks_url":"https://api.github.com/repos/koopjs/winnow/hooks","issue_events_url":"https://api.github.com/repos/koopjs/winnow/issues/events{/number}","events_url":"https://api.github.com/repos/koopjs/winnow/events","assignees_url":"https://api.github.com/repos/koopjs/winnow/assignees{/user}","branches_url":"https://api.github.com/repos/koopjs/winnow/branches{/branch}","tags_url":"https://api.github.com/repos/koopjs/winnow/tags","blobs_url":"https://api.github.com/repos/koopjs/winnow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/koopjs/winnow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/koopjs/winnow/git/refs{/sha}","trees_url":"https://api.github.com/repos/koopjs/winnow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/koopjs/winnow/statuses/{sha}","languages_url":"https://api.github.com/repos/koopjs/winnow/languages","stargazers_url":"https://api.github.com/repos/koopjs/winnow/stargazers","contributors_url":"https://api.github.com/repos/koopjs/winnow/contributors","subscribers_url":"https://api.github.com/repos/koopjs/winnow/subscribers","subscription_url":"https://api.github.com/repos/koopjs/winnow/subscription","commits_url":"https://api.github.com/repos/koopjs/winnow/commits{/sha}","git_commits_url":"https://api.github.com/repos/koopjs/winnow/git/commits{/sha}","comments_url":"https://api.github.com/repos/koopjs/winnow/comments{/number}","issue_comment_url":"https://api.github.com/repos/koopjs/winnow/issues/comments{/number}","contents_url":"https://api.github.com/repos/koopjs/winnow/contents/{+path}","compare_url":"https://api.github.com/repos/koopjs/winnow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/koopjs/winnow/merges","archive_url":"https://api.github.com/repos/koopjs/winnow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/koopjs/winnow/downloads","issues_url":"https://api.github.com/repos/koopjs/winnow/issues{/number}","pulls_url":"https://api.github.com/repos/koopjs/winnow/pulls{/number}","milestones_url":"https://api.github.com/repos/koopjs/winnow/milestones{/number}","notifications_url":"https://api.github.com/repos/koopjs/winnow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/koopjs/winnow/labels{/name}","releases_url":"https://api.github.com/repos/koopjs/winnow/releases{/id}","deployments_url":"https://api.github.com/repos/koopjs/winnow/deployments","created_at":"2016-02-19T19:14:26Z","updated_at":"2018-04-08T21:45:10Z","pushed_at":"2018-04-15T06:41:46Z","git_url":"git://github.com/koopjs/winnow.git","ssh_url":"git@github.com:koopjs/winnow.git","clone_url":"https://github.com/koopjs/winnow.git","svn_url":"https://github.com/koopjs/winnow","homepage":"","size":28293,"stargazers_count":38,"watchers_count":38,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":6,"open_issues":3,"watchers":38,"default_branch":"master"}},"base":{"label":"koopjs:master","ref":"master","sha":"f9dba6526271a7abf2a3a0fdbfa6ee4f4f111829","user":{"login":"koopjs","id":11509517,"avatar_url":"https://avatars2.githubusercontent.com/u/11509517?v=4","gravatar_id":"","url":"https://api.github.com/users/koopjs","html_url":"https://github.com/koopjs","followers_url":"https://api.github.com/users/koopjs/followers","following_url":"https://api.github.com/users/koopjs/following{/other_user}","gists_url":"https://api.github.com/users/koopjs/gists{/gist_id}","starred_url":"https://api.github.com/users/koopjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koopjs/subscriptions","organizations_url":"https://api.github.com/users/koopjs/orgs","repos_url":"https://api.github.com/users/koopjs/repos","events_url":"https://api.github.com/users/koopjs/events{/privacy}","received_events_url":"https://api.github.com/users/koopjs/received_events","type":"Organization","site_admin":false},"repo":{"id":52110344,"name":"winnow","full_name":"koopjs/winnow","owner":{"login":"koopjs","id":11509517,"avatar_url":"https://avatars2.githubusercontent.com/u/11509517?v=4","gravatar_id":"","url":"https://api.github.com/users/koopjs","html_url":"https://github.com/koopjs","followers_url":"https://api.github.com/users/koopjs/followers","following_url":"https://api.github.com/users/koopjs/following{/other_user}","gists_url":"https://api.github.com/users/koopjs/gists{/gist_id}","starred_url":"https://api.github.com/users/koopjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koopjs/subscriptions","organizations_url":"https://api.github.com/users/koopjs/orgs","repos_url":"https://api.github.com/users/koopjs/repos","events_url":"https://api.github.com/users/koopjs/events{/privacy}","received_events_url":"https://api.github.com/users/koopjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/koopjs/winnow","description":"Run SQL queries against GeoJSON without a database","fork":false,"url":"https://api.github.com/repos/koopjs/winnow","forks_url":"https://api.github.com/repos/koopjs/winnow/forks","keys_url":"https://api.github.com/repos/koopjs/winnow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/koopjs/winnow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/koopjs/winnow/teams","hooks_url":"https://api.github.com/repos/koopjs/winnow/hooks","issue_events_url":"https://api.github.com/repos/koopjs/winnow/issues/events{/number}","events_url":"https://api.github.com/repos/koopjs/winnow/events","assignees_url":"https://api.github.com/repos/koopjs/winnow/assignees{/user}","branches_url":"https://api.github.com/repos/koopjs/winnow/branches{/branch}","tags_url":"https://api.github.com/repos/koopjs/winnow/tags","blobs_url":"https://api.github.com/repos/koopjs/winnow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/koopjs/winnow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/koopjs/winnow/git/refs{/sha}","trees_url":"https://api.github.com/repos/koopjs/winnow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/koopjs/winnow/statuses/{sha}","languages_url":"https://api.github.com/repos/koopjs/winnow/languages","stargazers_url":"https://api.github.com/repos/koopjs/winnow/stargazers","contributors_url":"https://api.github.com/repos/koopjs/winnow/contributors","subscribers_url":"https://api.github.com/repos/koopjs/winnow/subscribers","subscription_url":"https://api.github.com/repos/koopjs/winnow/subscription","commits_url":"https://api.github.com/repos/koopjs/winnow/commits{/sha}","git_commits_url":"https://api.github.com/repos/koopjs/winnow/git/commits{/sha}","comments_url":"https://api.github.com/repos/koopjs/winnow/comments{/number}","issue_comment_url":"https://api.github.com/repos/koopjs/winnow/issues/comments{/number}","contents_url":"https://api.github.com/repos/koopjs/winnow/contents/{+path}","compare_url":"https://api.github.com/repos/koopjs/winnow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/koopjs/winnow/merges","archive_url":"https://api.github.com/repos/koopjs/winnow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/koopjs/winnow/downloads","issues_url":"https://api.github.com/repos/koopjs/winnow/issues{/number}","pulls_url":"https://api.github.com/repos/koopjs/winnow/pulls{/number}","milestones_url":"https://api.github.com/repos/koopjs/winnow/milestones{/number}","notifications_url":"https://api.github.com/repos/koopjs/winnow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/koopjs/winnow/labels{/name}","releases_url":"https://api.github.com/repos/koopjs/winnow/releases{/id}","deployments_url":"https://api.github.com/repos/koopjs/winnow/deployments","created_at":"2016-02-19T19:14:26Z","updated_at":"2018-04-08T21:45:10Z","pushed_at":"2018-04-15T06:41:46Z","git_url":"git://github.com/koopjs/winnow.git","ssh_url":"git@github.com:koopjs/winnow.git","clone_url":"https://github.com/koopjs/winnow.git","svn_url":"https://github.com/koopjs/winnow","homepage":"","size":28293,"stargazers_count":38,"watchers_count":38,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":6,"open_issues":3,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/koopjs/winnow/pulls/68"},"html":{"href":"https://github.com/koopjs/winnow/pull/68"},"issue":{"href":"https://api.github.com/repos/koopjs/winnow/issues/68"},"comments":{"href":"https://api.github.com/repos/koopjs/winnow/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/koopjs/winnow/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/koopjs/winnow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/koopjs/winnow/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/koopjs/winnow/statuses/99162498dc0eeee6947a15ca9929b3686f1c3f32"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"dmfenton"}}