{"action":"created","comment":{"url":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/comments/173660000","pull_request_review_id":102887166,"id":173660000,"diff_hunk":"@@ -477,107 +584,82 @@ defmodule Mongo.Ecto do\n   @read_queries [ReadQuery, CountQuery, AggregateQuery]\n \n   @doc false\n-  def execute(repo, _meta, {function, query}, params, preprocess, opts) do\n+  def execute(repo, _meta, {:nocache, {function, query}}, params, process, opts) do\n     case apply(NormalizedQuery, function, [query, params]) do\n       %{__struct__: read} = query when read in @read_queries ->\n         {rows, count} =\n-          Connection.read(repo.__mongo_pool__, query, opts)\n-          |> Enum.map_reduce(0, &{process_document(&1, query, preprocess), &2 + 1})\n+          Connection.read(repo, query, opts)\n+          |> Enum.map_reduce(0, &{process_document(&1, query, process), &2 + 1})\n+\n         {count, rows}\n+\n       %WriteQuery{} = write ->\n-        result = apply(Connection, function, [repo.__mongo_pool__, write, opts])\n+        result = apply(Connection, function, [repo, write, opts])\n         {result, nil}\n     end\n   end\n \n+  # This can be backed by a normal mongo stream, we just have to get it to play nicely with\n+  #  ecto's batch/preload functionality ( hence the map(&{nil, [&1]}) )\n   @doc false\n-  def insert(_repo, meta, _params, {key, :id, _}, _returning, _opts) do\n-    raise ArgumentError,\n-      \"MongoDB adapter does not support :id field type in models. \" <>\n-      \"The #{inspect key} field in #{inspect meta.model} is tagged as such.\"\n+  def stream(repo, _meta, {:nocache, {function, query}}, params, process, opts) do\n+    case apply(NormalizedQuery, function, [query, params]) do\n+      %{__struct__: read} = query when read in @read_queries ->\n+        Connection.read(repo, query, opts)\n+        |> Stream.map(&process_document(&1, query, process))\n+\n+      %WriteQuery{} = write ->\n+        apply(Connection, function, [repo, write, opts])\n+        [nil]\n+    end\n+    |> Stream.map(&{nil, [&1]})\n   end\n \n-  def insert(_repo, meta, _params, _autogen, [_] = returning, _opts) do\n+  @doc false\n+  def insert(_repo, meta, _params, _on_conflict, [_ | _] = returning, _opts) do","path":"lib/mongo_ecto.ex","position":353,"original_position":353,"commit_id":"bf03c08bd32953870de76a0c643cd596066dcb68","original_commit_id":"bf03c08bd32953870de76a0c643cd596066dcb68","user":{"login":"ebert[bot]","id":23344435,"avatar_url":"https://avatars3.githubusercontent.com/in/597?v=4","gravatar_id":"","url":"https://api.github.com/users/ebert%5Bbot%5D","html_url":"https://github.com/apps/ebert","followers_url":"https://api.github.com/users/ebert%5Bbot%5D/followers","following_url":"https://api.github.com/users/ebert%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/ebert%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/ebert%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebert%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/ebert%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/ebert%5Bbot%5D/repos","events_url":"https://api.github.com/users/ebert%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/ebert%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"Function takes too many parameters (arity is 6, max is 5).","created_at":"2018-03-11T16:08:55Z","updated_at":"2018-03-11T16:08:56Z","html_url":"https://github.com/ankhers/mongodb_ecto/pull/123#discussion_r173660000","pull_request_url":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/123","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/comments/173660000"},"html":{"href":"https://github.com/ankhers/mongodb_ecto/pull/123#discussion_r173660000"},"pull_request":{"href":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/123"}}},"pull_request":{"url":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/123","id":122517250,"html_url":"https://github.com/ankhers/mongodb_ecto/pull/123","diff_url":"https://github.com/ankhers/mongodb_ecto/pull/123.diff","patch_url":"https://github.com/ankhers/mongodb_ecto/pull/123.patch","issue_url":"https://api.github.com/repos/ankhers/mongodb_ecto/issues/123","number":123,"state":"open","locked":false,"title":"[WIP] Ecto 2.1","user":{"login":"ankhers","id":750786,"avatar_url":"https://avatars2.githubusercontent.com/u/750786?v=4","gravatar_id":"","url":"https://api.github.com/users/ankhers","html_url":"https://github.com/ankhers","followers_url":"https://api.github.com/users/ankhers/followers","following_url":"https://api.github.com/users/ankhers/following{/other_user}","gists_url":"https://api.github.com/users/ankhers/gists{/gist_id}","starred_url":"https://api.github.com/users/ankhers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ankhers/subscriptions","organizations_url":"https://api.github.com/users/ankhers/orgs","repos_url":"https://api.github.com/users/ankhers/repos","events_url":"https://api.github.com/users/ankhers/events{/privacy}","received_events_url":"https://api.github.com/users/ankhers/received_events","type":"User","site_admin":false},"body":"**NOTE:** The on conflict feature introduced in Ecto 2.1 is not working at all yet, but this branch should at least be usable. Please leave a note here if you run into any issues while using this branch.\r\n\r\nThe following is a list of tests that this branch will not be fixing, either because it does not make enough sense to within the context of Mongo, or I believe that it is actually an issue with Ecto proper\r\n\r\n* deps/ecto/integration_test/cases/repo.exs\r\n  * 302: unique pseudo-constraint violation error message with join table at the repository -- Mongo does not support joins\r\n  * 637: insert all -- Mongo recognizes `nil`s as the same, preventing the insertion of two empty `Post`s\r\n  * 960: query select take with maps -- This should be an issue with Ecto. It is preventing a string from being made into an atom\r\n  * 1063: load -- This adapter does not support `Ecto.Adapters.SQL.query!/4`\r\n\r\n* deps/ecto/integration_test/cases/type.exs\r\n  * 62: tagged types -- Mongo does not support casting from a query\r\n  * 87: array type -- `where: ^\"b\" in ^[\"a\", \"b\", \"c\"]` does not make sense in the context of mongo","created_at":"2017-05-25T20:19:32Z","updated_at":"2018-03-11T16:08:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/123/commits","review_comments_url":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/123/comments","review_comment_url":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ankhers/mongodb_ecto/issues/123/comments","statuses_url":"https://api.github.com/repos/ankhers/mongodb_ecto/statuses/bf03c08bd32953870de76a0c643cd596066dcb68","head":{"label":"ankhers:ecto-2.1","ref":"ecto-2.1","sha":"bf03c08bd32953870de76a0c643cd596066dcb68","user":{"login":"ankhers","id":750786,"avatar_url":"https://avatars2.githubusercontent.com/u/750786?v=4","gravatar_id":"","url":"https://api.github.com/users/ankhers","html_url":"https://github.com/ankhers","followers_url":"https://api.github.com/users/ankhers/followers","following_url":"https://api.github.com/users/ankhers/following{/other_user}","gists_url":"https://api.github.com/users/ankhers/gists{/gist_id}","starred_url":"https://api.github.com/users/ankhers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ankhers/subscriptions","organizations_url":"https://api.github.com/users/ankhers/orgs","repos_url":"https://api.github.com/users/ankhers/repos","events_url":"https://api.github.com/users/ankhers/events{/privacy}","received_events_url":"https://api.github.com/users/ankhers/received_events","type":"User","site_admin":false},"repo":{"id":36249824,"name":"mongodb_ecto","full_name":"ankhers/mongodb_ecto","owner":{"login":"ankhers","id":750786,"avatar_url":"https://avatars2.githubusercontent.com/u/750786?v=4","gravatar_id":"","url":"https://api.github.com/users/ankhers","html_url":"https://github.com/ankhers","followers_url":"https://api.github.com/users/ankhers/followers","following_url":"https://api.github.com/users/ankhers/following{/other_user}","gists_url":"https://api.github.com/users/ankhers/gists{/gist_id}","starred_url":"https://api.github.com/users/ankhers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ankhers/subscriptions","organizations_url":"https://api.github.com/users/ankhers/orgs","repos_url":"https://api.github.com/users/ankhers/repos","events_url":"https://api.github.com/users/ankhers/events{/privacy}","received_events_url":"https://api.github.com/users/ankhers/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ankhers/mongodb_ecto","description":"MongoDB adapter for Ecto","fork":false,"url":"https://api.github.com/repos/ankhers/mongodb_ecto","forks_url":"https://api.github.com/repos/ankhers/mongodb_ecto/forks","keys_url":"https://api.github.com/repos/ankhers/mongodb_ecto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ankhers/mongodb_ecto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ankhers/mongodb_ecto/teams","hooks_url":"https://api.github.com/repos/ankhers/mongodb_ecto/hooks","issue_events_url":"https://api.github.com/repos/ankhers/mongodb_ecto/issues/events{/number}","events_url":"https://api.github.com/repos/ankhers/mongodb_ecto/events","assignees_url":"https://api.github.com/repos/ankhers/mongodb_ecto/assignees{/user}","branches_url":"https://api.github.com/repos/ankhers/mongodb_ecto/branches{/branch}","tags_url":"https://api.github.com/repos/ankhers/mongodb_ecto/tags","blobs_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/refs{/sha}","trees_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ankhers/mongodb_ecto/statuses/{sha}","languages_url":"https://api.github.com/repos/ankhers/mongodb_ecto/languages","stargazers_url":"https://api.github.com/repos/ankhers/mongodb_ecto/stargazers","contributors_url":"https://api.github.com/repos/ankhers/mongodb_ecto/contributors","subscribers_url":"https://api.github.com/repos/ankhers/mongodb_ecto/subscribers","subscription_url":"https://api.github.com/repos/ankhers/mongodb_ecto/subscription","commits_url":"https://api.github.com/repos/ankhers/mongodb_ecto/commits{/sha}","git_commits_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/commits{/sha}","comments_url":"https://api.github.com/repos/ankhers/mongodb_ecto/comments{/number}","issue_comment_url":"https://api.github.com/repos/ankhers/mongodb_ecto/issues/comments{/number}","contents_url":"https://api.github.com/repos/ankhers/mongodb_ecto/contents/{+path}","compare_url":"https://api.github.com/repos/ankhers/mongodb_ecto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ankhers/mongodb_ecto/merges","archive_url":"https://api.github.com/repos/ankhers/mongodb_ecto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ankhers/mongodb_ecto/downloads","issues_url":"https://api.github.com/repos/ankhers/mongodb_ecto/issues{/number}","pulls_url":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls{/number}","milestones_url":"https://api.github.com/repos/ankhers/mongodb_ecto/milestones{/number}","notifications_url":"https://api.github.com/repos/ankhers/mongodb_ecto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ankhers/mongodb_ecto/labels{/name}","releases_url":"https://api.github.com/repos/ankhers/mongodb_ecto/releases{/id}","deployments_url":"https://api.github.com/repos/ankhers/mongodb_ecto/deployments","created_at":"2015-05-25T19:18:02Z","updated_at":"2018-02-23T21:47:44Z","pushed_at":"2018-03-11T16:07:56Z","git_url":"git://github.com/ankhers/mongodb_ecto.git","ssh_url":"git@github.com:ankhers/mongodb_ecto.git","clone_url":"https://github.com/ankhers/mongodb_ecto.git","svn_url":"https://github.com/ankhers/mongodb_ecto","homepage":null,"size":400,"stargazers_count":249,"watchers_count":249,"language":"Elixir","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"archived":false,"open_issues_count":19,"license":null,"forks":85,"open_issues":19,"watchers":249,"default_branch":"master"}},"base":{"label":"ankhers:master","ref":"master","sha":"e7a4fed09d877bf9ae0cb2a47809851470a70aa7","user":{"login":"ankhers","id":750786,"avatar_url":"https://avatars2.githubusercontent.com/u/750786?v=4","gravatar_id":"","url":"https://api.github.com/users/ankhers","html_url":"https://github.com/ankhers","followers_url":"https://api.github.com/users/ankhers/followers","following_url":"https://api.github.com/users/ankhers/following{/other_user}","gists_url":"https://api.github.com/users/ankhers/gists{/gist_id}","starred_url":"https://api.github.com/users/ankhers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ankhers/subscriptions","organizations_url":"https://api.github.com/users/ankhers/orgs","repos_url":"https://api.github.com/users/ankhers/repos","events_url":"https://api.github.com/users/ankhers/events{/privacy}","received_events_url":"https://api.github.com/users/ankhers/received_events","type":"User","site_admin":false},"repo":{"id":36249824,"name":"mongodb_ecto","full_name":"ankhers/mongodb_ecto","owner":{"login":"ankhers","id":750786,"avatar_url":"https://avatars2.githubusercontent.com/u/750786?v=4","gravatar_id":"","url":"https://api.github.com/users/ankhers","html_url":"https://github.com/ankhers","followers_url":"https://api.github.com/users/ankhers/followers","following_url":"https://api.github.com/users/ankhers/following{/other_user}","gists_url":"https://api.github.com/users/ankhers/gists{/gist_id}","starred_url":"https://api.github.com/users/ankhers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ankhers/subscriptions","organizations_url":"https://api.github.com/users/ankhers/orgs","repos_url":"https://api.github.com/users/ankhers/repos","events_url":"https://api.github.com/users/ankhers/events{/privacy}","received_events_url":"https://api.github.com/users/ankhers/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ankhers/mongodb_ecto","description":"MongoDB adapter for Ecto","fork":false,"url":"https://api.github.com/repos/ankhers/mongodb_ecto","forks_url":"https://api.github.com/repos/ankhers/mongodb_ecto/forks","keys_url":"https://api.github.com/repos/ankhers/mongodb_ecto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ankhers/mongodb_ecto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ankhers/mongodb_ecto/teams","hooks_url":"https://api.github.com/repos/ankhers/mongodb_ecto/hooks","issue_events_url":"https://api.github.com/repos/ankhers/mongodb_ecto/issues/events{/number}","events_url":"https://api.github.com/repos/ankhers/mongodb_ecto/events","assignees_url":"https://api.github.com/repos/ankhers/mongodb_ecto/assignees{/user}","branches_url":"https://api.github.com/repos/ankhers/mongodb_ecto/branches{/branch}","tags_url":"https://api.github.com/repos/ankhers/mongodb_ecto/tags","blobs_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/refs{/sha}","trees_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ankhers/mongodb_ecto/statuses/{sha}","languages_url":"https://api.github.com/repos/ankhers/mongodb_ecto/languages","stargazers_url":"https://api.github.com/repos/ankhers/mongodb_ecto/stargazers","contributors_url":"https://api.github.com/repos/ankhers/mongodb_ecto/contributors","subscribers_url":"https://api.github.com/repos/ankhers/mongodb_ecto/subscribers","subscription_url":"https://api.github.com/repos/ankhers/mongodb_ecto/subscription","commits_url":"https://api.github.com/repos/ankhers/mongodb_ecto/commits{/sha}","git_commits_url":"https://api.github.com/repos/ankhers/mongodb_ecto/git/commits{/sha}","comments_url":"https://api.github.com/repos/ankhers/mongodb_ecto/comments{/number}","issue_comment_url":"https://api.github.com/repos/ankhers/mongodb_ecto/issues/comments{/number}","contents_url":"https://api.github.com/repos/ankhers/mongodb_ecto/contents/{+path}","compare_url":"https://api.github.com/repos/ankhers/mongodb_ecto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ankhers/mongodb_ecto/merges","archive_url":"https://api.github.com/repos/ankhers/mongodb_ecto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ankhers/mongodb_ecto/downloads","issues_url":"https://api.github.com/repos/ankhers/mongodb_ecto/issues{/number}","pulls_url":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls{/number}","milestones_url":"https://api.github.com/repos/ankhers/mongodb_ecto/milestones{/number}","notifications_url":"https://api.github.com/repos/ankhers/mongodb_ecto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ankhers/mongodb_ecto/labels{/name}","releases_url":"https://api.github.com/repos/ankhers/mongodb_ecto/releases{/id}","deployments_url":"https://api.github.com/repos/ankhers/mongodb_ecto/deployments","created_at":"2015-05-25T19:18:02Z","updated_at":"2018-02-23T21:47:44Z","pushed_at":"2018-03-11T16:07:56Z","git_url":"git://github.com/ankhers/mongodb_ecto.git","ssh_url":"git@github.com:ankhers/mongodb_ecto.git","clone_url":"https://github.com/ankhers/mongodb_ecto.git","svn_url":"https://github.com/ankhers/mongodb_ecto","homepage":null,"size":400,"stargazers_count":249,"watchers_count":249,"language":"Elixir","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"archived":false,"open_issues_count":19,"license":null,"forks":85,"open_issues":19,"watchers":249,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/123"},"html":{"href":"https://github.com/ankhers/mongodb_ecto/pull/123"},"issue":{"href":"https://api.github.com/repos/ankhers/mongodb_ecto/issues/123"},"comments":{"href":"https://api.github.com/repos/ankhers/mongodb_ecto/issues/123/comments"},"review_comments":{"href":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/123/comments"},"review_comment":{"href":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ankhers/mongodb_ecto/pulls/123/commits"},"statuses":{"href":"https://api.github.com/repos/ankhers/mongodb_ecto/statuses/bf03c08bd32953870de76a0c643cd596066dcb68"}},"author_association":"OWNER"}}
{"actor":{"display_login":"ebert"}}