{"action":"created","comment":{"url":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments/209663221","pull_request_review_id":145719515,"id":209663221,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTY2MzIyMQ==","diff_hunk":"@@ -0,0 +1,126 @@\n+package com.prisma.api.connector.mongo\n+\n+import com.prisma.api.connector._\n+import com.prisma.api.connector.mongo.database._\n+import com.prisma.api.connector.mongo.impl._\n+import com.prisma.gc_values.IdGCValue\n+import org.mongodb.scala.{MongoClient, MongoDatabase}\n+\n+import scala.concurrent.{ExecutionContext, Future}\n+\n+class MongoDatabaseMutactionExecutor(client: MongoClient)(implicit ec: ExecutionContext) extends DatabaseMutactionExecutor {\n+\n+  override def executeTransactionally(mutaction: TopLevelDatabaseMutaction): Future[MutactionResults] = execute(mutaction, transactionally = true)\n+\n+  override def executeNonTransactionally(mutaction: TopLevelDatabaseMutaction): Future[MutactionResults] = execute(mutaction, transactionally = false)\n+\n+  private def execute(mutaction: TopLevelDatabaseMutaction, transactionally: Boolean): Future[MutactionResults] = {\n+    val actionsBuilder = MongoActionsBuilder(mutaction.project.id, client)\n+    val action         = generateTopLevelMutaction(actionsBuilder.database, mutaction, actionsBuilder)\n+\n+    run(actionsBuilder.database, action)\n+  }\n+\n+  def generateNestedMutaction(\n+      database: MongoDatabase,\n+      mutaction: NestedDatabaseMutaction,\n+      parentId: IdGCValue,\n+      mutationBuilder: MongoActionsBuilder\n+  ): MongoAction[MutactionResults] = {\n+    generateMutaction[NestedDatabaseMutaction](database, mutaction, mutationBuilder, mut => interpreterFor(mut).mongoAction(mutationBuilder, parentId))\n+  }\n+\n+  def generateTopLevelMutaction(\n+      database: MongoDatabase,\n+      mutaction: TopLevelDatabaseMutaction,\n+      mutationBuilder: MongoActionsBuilder\n+  ): MongoAction[MutactionResults] = {\n+    generateMutaction[TopLevelDatabaseMutaction](database, mutaction, mutationBuilder, mut => interpreterFor(mut).mongoAction(mutationBuilder))\n+  }\n+\n+  def generateMutaction[T <: DatabaseMutaction](\n+      database: MongoDatabase,\n+      mutaction: T,\n+      mutationBuilder: MongoActionsBuilder,\n+      fn: T => MongoAction[MutactionResults]\n+  ): MongoAction[MutactionResults] = {\n+    mutaction match {\n+      case m: FurtherNestedMutaction =>\n+        for {\n+          result <- fn(mutaction)\n+          childResults <- result match {\n+                           case result: FurtherNestedMutactionResult =>\n+                             val stillToExecute = m.allNestedMutactions diff result.results\n+                             val x              = stillToExecute.map(x => generateNestedMutaction(database, x, result.id, mutationBuilder))\n+                             MongoAction.seq(x)\n+                           case _ => MongoAction.successful(Vector.empty)\n+                         }\n+        } yield MutactionResults(result.results ++ childResults.flatMap(_.results))\n+\n+      case m: FinalMutaction =>\n+        for {\n+          result <- fn(mutaction)\n+        } yield result\n+\n+      case _ => sys.error(\"not implemented yet\")\n+    }\n+  }\n+\n+  def interpreterFor(mutaction: TopLevelDatabaseMutaction): TopLevelDatabaseMutactionInterpreter = mutaction match {\n+    case m: TopLevelCreateNode => CreateNodeInterpreter(mutaction = m, includeRelayRow = false)\n+    case m: TopLevelUpdateNode => UpdateNodeInterpreter(mutaction = m)\n+    case m: TopLevelUpsertNode => ???\n+    case m: TopLevelDeleteNode => DeleteNodeInterpreter(mutaction = m)\n+    case m: UpdateNodes        => ???\n+    case m: DeleteNodes        => ???\n+    case m: ResetData          => ResetDataInterpreter(mutaction = m)\n+    case m: ImportNodes        => ???\n+    case m: ImportRelations    => ???\n+    case m: ImportScalarLists  => ???","path":"server/connectors/api-connector-mongo/src/main/scala/com/prisma/api/connector/mongo/MongoDatabaseMutactionExecutor.scala","position":79,"original_position":79,"commit_id":"d7834ba8ccca05a4539f80aca446de04c18c87a7","original_commit_id":"d7834ba8ccca05a4539f80aca446de04c18c87a7","user":{"login":"codacy-bot","id":19940114,"node_id":"MDQ6VXNlcjE5OTQwMTE0","avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Usage of ??? operator](https://app.codacy.com/app/graphcool/prisma/pullRequest?prid=2002555)","created_at":"2018-08-13T15:54:11Z","updated_at":"2018-08-13T15:54:11Z","html_url":"https://github.com/prismagraphql/prisma/pull/2883#discussion_r209663221","pull_request_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2883","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments/209663221"},"html":{"href":"https://github.com/prismagraphql/prisma/pull/2883#discussion_r209663221"},"pull_request":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2883"}}},"pull_request":{"url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2883","id":206375310,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2Mzc1MzEw","html_url":"https://github.com/prismagraphql/prisma/pull/2883","diff_url":"https://github.com/prismagraphql/prisma/pull/2883.diff","patch_url":"https://github.com/prismagraphql/prisma/pull/2883.patch","issue_url":"https://api.github.com/repos/prismagraphql/prisma/issues/2883","number":2883,"state":"open","locked":false,"title":"[WIP] Mongo db connector","user":{"login":"do4gr","id":16278407,"node_id":"MDQ6VXNlcjE2Mjc4NDA3","avatar_url":"https://avatars2.githubusercontent.com/u/16278407?v=4","gravatar_id":"","url":"https://api.github.com/users/do4gr","html_url":"https://github.com/do4gr","followers_url":"https://api.github.com/users/do4gr/followers","following_url":"https://api.github.com/users/do4gr/following{/other_user}","gists_url":"https://api.github.com/users/do4gr/gists{/gist_id}","starred_url":"https://api.github.com/users/do4gr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/do4gr/subscriptions","organizations_url":"https://api.github.com/users/do4gr/orgs","repos_url":"https://api.github.com/users/do4gr/repos","events_url":"https://api.github.com/users/do4gr/events{/privacy}","received_events_url":"https://api.github.com/users/do4gr/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-06T11:56:35Z","updated_at":"2018-08-13T15:54:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce2a449cad47fa23361ffa02a5ec685f6cc74687","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2883/commits","review_comments_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2883/comments","review_comment_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prismagraphql/prisma/issues/2883/comments","statuses_url":"https://api.github.com/repos/prismagraphql/prisma/statuses/d7834ba8ccca05a4539f80aca446de04c18c87a7","head":{"label":"prismagraphql:MongoDBConnector","ref":"MongoDBConnector","sha":"d7834ba8ccca05a4539f80aca446de04c18c87a7","user":{"login":"prismagraphql","id":17219288,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjE5Mjg4","avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"repo":{"id":69164196,"node_id":"MDEwOlJlcG9zaXRvcnk2OTE2NDE5Ng==","name":"prisma","full_name":"prismagraphql/prisma","owner":{"login":"prismagraphql","id":17219288,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjE5Mjg4","avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prismagraphql/prisma","description":"⚡️ Prisma turns your database into a realtime GraphQL API","fork":false,"url":"https://api.github.com/repos/prismagraphql/prisma","forks_url":"https://api.github.com/repos/prismagraphql/prisma/forks","keys_url":"https://api.github.com/repos/prismagraphql/prisma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prismagraphql/prisma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prismagraphql/prisma/teams","hooks_url":"https://api.github.com/repos/prismagraphql/prisma/hooks","issue_events_url":"https://api.github.com/repos/prismagraphql/prisma/issues/events{/number}","events_url":"https://api.github.com/repos/prismagraphql/prisma/events","assignees_url":"https://api.github.com/repos/prismagraphql/prisma/assignees{/user}","branches_url":"https://api.github.com/repos/prismagraphql/prisma/branches{/branch}","tags_url":"https://api.github.com/repos/prismagraphql/prisma/tags","blobs_url":"https://api.github.com/repos/prismagraphql/prisma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prismagraphql/prisma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prismagraphql/prisma/git/refs{/sha}","trees_url":"https://api.github.com/repos/prismagraphql/prisma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prismagraphql/prisma/statuses/{sha}","languages_url":"https://api.github.com/repos/prismagraphql/prisma/languages","stargazers_url":"https://api.github.com/repos/prismagraphql/prisma/stargazers","contributors_url":"https://api.github.com/repos/prismagraphql/prisma/contributors","subscribers_url":"https://api.github.com/repos/prismagraphql/prisma/subscribers","subscription_url":"https://api.github.com/repos/prismagraphql/prisma/subscription","commits_url":"https://api.github.com/repos/prismagraphql/prisma/commits{/sha}","git_commits_url":"https://api.github.com/repos/prismagraphql/prisma/git/commits{/sha}","comments_url":"https://api.github.com/repos/prismagraphql/prisma/comments{/number}","issue_comment_url":"https://api.github.com/repos/prismagraphql/prisma/issues/comments{/number}","contents_url":"https://api.github.com/repos/prismagraphql/prisma/contents/{+path}","compare_url":"https://api.github.com/repos/prismagraphql/prisma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prismagraphql/prisma/merges","archive_url":"https://api.github.com/repos/prismagraphql/prisma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prismagraphql/prisma/downloads","issues_url":"https://api.github.com/repos/prismagraphql/prisma/issues{/number}","pulls_url":"https://api.github.com/repos/prismagraphql/prisma/pulls{/number}","milestones_url":"https://api.github.com/repos/prismagraphql/prisma/milestones{/number}","notifications_url":"https://api.github.com/repos/prismagraphql/prisma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prismagraphql/prisma/labels{/name}","releases_url":"https://api.github.com/repos/prismagraphql/prisma/releases{/id}","deployments_url":"https://api.github.com/repos/prismagraphql/prisma/deployments","created_at":"2016-09-25T12:54:40Z","updated_at":"2018-08-13T15:07:23Z","pushed_at":"2018-08-13T15:51:17Z","git_url":"git://github.com/prismagraphql/prisma.git","ssh_url":"git@github.com:prismagraphql/prisma.git","clone_url":"https://github.com/prismagraphql/prisma.git","svn_url":"https://github.com/prismagraphql/prisma","homepage":"https://www.prisma.io/","size":19373,"stargazers_count":9710,"watchers_count":9710,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":540,"mirror_url":null,"archived":false,"open_issues_count":402,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":540,"open_issues":402,"watchers":9710,"default_branch":"master"}},"base":{"label":"prismagraphql:alpha","ref":"alpha","sha":"fbe3d1a83978f9541cd1c3a6768cb709fb53c8b4","user":{"login":"prismagraphql","id":17219288,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjE5Mjg4","avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"repo":{"id":69164196,"node_id":"MDEwOlJlcG9zaXRvcnk2OTE2NDE5Ng==","name":"prisma","full_name":"prismagraphql/prisma","owner":{"login":"prismagraphql","id":17219288,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjE5Mjg4","avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prismagraphql/prisma","description":"⚡️ Prisma turns your database into a realtime GraphQL API","fork":false,"url":"https://api.github.com/repos/prismagraphql/prisma","forks_url":"https://api.github.com/repos/prismagraphql/prisma/forks","keys_url":"https://api.github.com/repos/prismagraphql/prisma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prismagraphql/prisma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prismagraphql/prisma/teams","hooks_url":"https://api.github.com/repos/prismagraphql/prisma/hooks","issue_events_url":"https://api.github.com/repos/prismagraphql/prisma/issues/events{/number}","events_url":"https://api.github.com/repos/prismagraphql/prisma/events","assignees_url":"https://api.github.com/repos/prismagraphql/prisma/assignees{/user}","branches_url":"https://api.github.com/repos/prismagraphql/prisma/branches{/branch}","tags_url":"https://api.github.com/repos/prismagraphql/prisma/tags","blobs_url":"https://api.github.com/repos/prismagraphql/prisma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prismagraphql/prisma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prismagraphql/prisma/git/refs{/sha}","trees_url":"https://api.github.com/repos/prismagraphql/prisma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prismagraphql/prisma/statuses/{sha}","languages_url":"https://api.github.com/repos/prismagraphql/prisma/languages","stargazers_url":"https://api.github.com/repos/prismagraphql/prisma/stargazers","contributors_url":"https://api.github.com/repos/prismagraphql/prisma/contributors","subscribers_url":"https://api.github.com/repos/prismagraphql/prisma/subscribers","subscription_url":"https://api.github.com/repos/prismagraphql/prisma/subscription","commits_url":"https://api.github.com/repos/prismagraphql/prisma/commits{/sha}","git_commits_url":"https://api.github.com/repos/prismagraphql/prisma/git/commits{/sha}","comments_url":"https://api.github.com/repos/prismagraphql/prisma/comments{/number}","issue_comment_url":"https://api.github.com/repos/prismagraphql/prisma/issues/comments{/number}","contents_url":"https://api.github.com/repos/prismagraphql/prisma/contents/{+path}","compare_url":"https://api.github.com/repos/prismagraphql/prisma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prismagraphql/prisma/merges","archive_url":"https://api.github.com/repos/prismagraphql/prisma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prismagraphql/prisma/downloads","issues_url":"https://api.github.com/repos/prismagraphql/prisma/issues{/number}","pulls_url":"https://api.github.com/repos/prismagraphql/prisma/pulls{/number}","milestones_url":"https://api.github.com/repos/prismagraphql/prisma/milestones{/number}","notifications_url":"https://api.github.com/repos/prismagraphql/prisma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prismagraphql/prisma/labels{/name}","releases_url":"https://api.github.com/repos/prismagraphql/prisma/releases{/id}","deployments_url":"https://api.github.com/repos/prismagraphql/prisma/deployments","created_at":"2016-09-25T12:54:40Z","updated_at":"2018-08-13T15:07:23Z","pushed_at":"2018-08-13T15:51:17Z","git_url":"git://github.com/prismagraphql/prisma.git","ssh_url":"git@github.com:prismagraphql/prisma.git","clone_url":"https://github.com/prismagraphql/prisma.git","svn_url":"https://github.com/prismagraphql/prisma","homepage":"https://www.prisma.io/","size":19373,"stargazers_count":9710,"watchers_count":9710,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":540,"mirror_url":null,"archived":false,"open_issues_count":402,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":540,"open_issues":402,"watchers":9710,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2883"},"html":{"href":"https://github.com/prismagraphql/prisma/pull/2883"},"issue":{"href":"https://api.github.com/repos/prismagraphql/prisma/issues/2883"},"comments":{"href":"https://api.github.com/repos/prismagraphql/prisma/issues/2883/comments"},"review_comments":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2883/comments"},"review_comment":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2883/commits"},"statuses":{"href":"https://api.github.com/repos/prismagraphql/prisma/statuses/d7834ba8ccca05a4539f80aca446de04c18c87a7"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"codacy-bot"}}