{"action":"created","comment":{"url":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/comments/24443016","id":24443016,"diff_hunk":"@@ -0,0 +1,166 @@\n+/*\n+ * Copyright 2015 MongoDB, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.mongodb.scala.reactivestreams.client\n+\n+import com.mongodb.client.model.CreateCollectionOptions\n+import com.mongodb.reactivestreams.client.{ MongoDatabase => JMongoDatabase }\n+import com.mongodb.scala.reactivestreams.client.Helpers.classTagToClassOf\n+import com.mongodb.{ ReadPreference, WriteConcern }\n+import org.bson.Document\n+import org.bson.codecs.configuration.CodecRegistry\n+import org.reactivestreams.Publisher\n+\n+import scala.reflect.ClassTag\n+\n+/**\n+ * The MongoDatabase representation.\n+ *\n+ */\n+case class MongoDatabase(wrapped: JMongoDatabase) {\n+\n+  /**\n+   * Gets the name of the database.\n+   *\n+   * @return the database name\n+   */\n+  lazy val name: String = wrapped.getName\n+\n+  /**\n+   * Get the codec registry for the MongoDatabase.\n+   *\n+   * @return the { @link org.bson.codecs.configuration.CodecRegistry}\n+   */\n+  lazy val codecRegistry: CodecRegistry = wrapped.getCodecRegistry\n+\n+  /**\n+   * Get the read preference for the MongoDatabase.\n+   *\n+   * @return the { @link com.mongodb.ReadPreference}\n+   */\n+  lazy val readPreference: ReadPreference = wrapped.getReadPreference\n+\n+  /**\n+   * Get the write concern for the MongoDatabase.\n+   *\n+   * @return the { @link com.mongodb.WriteConcern}\n+   */\n+  lazy val writeConcern: WriteConcern = wrapped.getWriteConcern\n+\n+  /**\n+   * Create a new MongoDatabase instance with a different codec registry.\n+   *\n+   * @param codecRegistry the new { @link org.bson.codecs.configuration.CodecRegistry} for the collection\n+   * @return a new MongoDatabase instance with the different codec registry\n+   */\n+  def withCodecRegistry(codecRegistry: CodecRegistry): MongoDatabase =\n+    MongoDatabase(wrapped.withCodecRegistry(codecRegistry))\n+\n+  /**\n+   * Create a new MongoDatabase instance with a different read preference.\n+   *\n+   * @param readPreference the new { @link com.mongodb.ReadPreference} for the collection\n+   * @return a new MongoDatabase instance with the different readPreference\n+   */\n+  def withReadPreference(readPreference: ReadPreference): MongoDatabase =\n+    MongoDatabase(wrapped.withReadPreference(readPreference))\n+\n+  /**\n+   * Create a new MongoDatabase instance with a different write concern.\n+   *\n+   * @param writeConcern the new { @link com.mongodb.WriteConcern} for the collection\n+   * @return a new MongoDatabase instance with the different writeConcern\n+   */\n+  def withWriteConcern(writeConcern: WriteConcern): MongoDatabase =\n+    MongoDatabase(wrapped.withWriteConcern(writeConcern))\n+\n+  /**\n+   * Gets a collection, with a specific default document class.\n+   *\n+   * @param collectionName the name of the collection to return\n+   * @tparam T            the type of the class to use instead of { @code Document}.\n+   * @return the collection\n+   */\n+  def getCollection[T](collectionName: String)(implicit e: T DefaultsTo Document, ct: ClassTag[T]): MongoCollection[T] =\n+    MongoCollection(wrapped.getCollection(collectionName, ct.runtimeClass.asInstanceOf[Class[T]]))\n+\n+  /**\n+   * Executes command in the context of the current database.\n+   *\n+   * @param command  the command to be run\n+   * @tparam T      the type of the class to use instead of { @code Document}.\n+   * @return a publisher containing the command result\n+   */\n+  def executeCommand[T](command: AnyRef)(implicit e: T DefaultsTo Document, ct: ClassTag[T]): Publisher[T] =\n+    wrapped.executeCommand[T](command, ct.runtimeClass.asInstanceOf[Class[T]])\n+\n+  /**\n+   * Executes command in the context of the current database.\n+   *\n+   * @param command        the command to be run\n+   * @param readPreference the { @link com.mongodb.ReadPreference} to be used when executing the command\n+   * @param clazz          the default class to cast any documents returned from the database into.\n+   * @tparam T            the type of the class to use instead of { @code Document}.","path":"driver/src/main/scala/com/mongodb/scala/reactivestreams/client/MongoDatabase.scala","position":116,"original_position":116,"commit_id":"91e009f8a04ad17a09ca19c4a520699baa29f4b5","original_commit_id":"91e009f8a04ad17a09ca19c4a520699baa29f4b5","user":{"login":"jyemin","id":1111546,"avatar_url":"https://avatars.githubusercontent.com/u/1111546?v=3","gravatar_id":"","url":"https://api.github.com/users/jyemin","html_url":"https://github.com/jyemin","followers_url":"https://api.github.com/users/jyemin/followers","following_url":"https://api.github.com/users/jyemin/following{/other_user}","gists_url":"https://api.github.com/users/jyemin/gists{/gist_id}","starred_url":"https://api.github.com/users/jyemin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyemin/subscriptions","organizations_url":"https://api.github.com/users/jyemin/orgs","repos_url":"https://api.github.com/users/jyemin/repos","events_url":"https://api.github.com/users/jyemin/events{/privacy}","received_events_url":"https://api.github.com/users/jyemin/received_events","type":"User","site_admin":false},"body":"should the description line up?","created_at":"2015-02-10T19:35:27Z","updated_at":"2015-02-10T19:35:27Z","html_url":"https://github.com/rozza/mongo-scala-driver/pull/2#discussion_r24443016","pull_request_url":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/comments/24443016"},"html":{"href":"https://github.com/rozza/mongo-scala-driver/pull/2#discussion_r24443016"},"pull_request":{"href":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/2","id":29001574,"html_url":"https://github.com/rozza/mongo-scala-driver/pull/2","diff_url":"https://github.com/rozza/mongo-scala-driver/pull/2.diff","patch_url":"https://github.com/rozza/mongo-scala-driver/pull/2.patch","issue_url":"https://api.github.com/repos/rozza/mongo-scala-driver/issues/2","number":2,"state":"open","locked":false,"title":"Updated the driver to be based on the Reactive Streams Java driver","user":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-10T12:04:22Z","updated_at":"2015-02-10T19:35:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07460eb4fd1e330785e52e6b547a0cc7326f4028","assignee":{"login":"jyemin","id":1111546,"avatar_url":"https://avatars.githubusercontent.com/u/1111546?v=3","gravatar_id":"","url":"https://api.github.com/users/jyemin","html_url":"https://github.com/jyemin","followers_url":"https://api.github.com/users/jyemin/followers","following_url":"https://api.github.com/users/jyemin/following{/other_user}","gists_url":"https://api.github.com/users/jyemin/gists{/gist_id}","starred_url":"https://api.github.com/users/jyemin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyemin/subscriptions","organizations_url":"https://api.github.com/users/jyemin/orgs","repos_url":"https://api.github.com/users/jyemin/repos","events_url":"https://api.github.com/users/jyemin/events{/privacy}","received_events_url":"https://api.github.com/users/jyemin/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/2/commits","review_comments_url":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/2/comments","review_comment_url":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rozza/mongo-scala-driver/issues/2/comments","statuses_url":"https://api.github.com/repos/rozza/mongo-scala-driver/statuses/91e009f8a04ad17a09ca19c4a520699baa29f4b5","head":{"label":"rozza:reactiveStreams","ref":"reactiveStreams","sha":"91e009f8a04ad17a09ca19c4a520699baa29f4b5","user":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"repo":{"id":17707682,"name":"mongo-scala-driver","full_name":"rozza/mongo-scala-driver","owner":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rozza/mongo-scala-driver","description":"","fork":true,"url":"https://api.github.com/repos/rozza/mongo-scala-driver","forks_url":"https://api.github.com/repos/rozza/mongo-scala-driver/forks","keys_url":"https://api.github.com/repos/rozza/mongo-scala-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rozza/mongo-scala-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rozza/mongo-scala-driver/teams","hooks_url":"https://api.github.com/repos/rozza/mongo-scala-driver/hooks","issue_events_url":"https://api.github.com/repos/rozza/mongo-scala-driver/issues/events{/number}","events_url":"https://api.github.com/repos/rozza/mongo-scala-driver/events","assignees_url":"https://api.github.com/repos/rozza/mongo-scala-driver/assignees{/user}","branches_url":"https://api.github.com/repos/rozza/mongo-scala-driver/branches{/branch}","tags_url":"https://api.github.com/repos/rozza/mongo-scala-driver/tags","blobs_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rozza/mongo-scala-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/rozza/mongo-scala-driver/languages","stargazers_url":"https://api.github.com/repos/rozza/mongo-scala-driver/stargazers","contributors_url":"https://api.github.com/repos/rozza/mongo-scala-driver/contributors","subscribers_url":"https://api.github.com/repos/rozza/mongo-scala-driver/subscribers","subscription_url":"https://api.github.com/repos/rozza/mongo-scala-driver/subscription","commits_url":"https://api.github.com/repos/rozza/mongo-scala-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/rozza/mongo-scala-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/rozza/mongo-scala-driver/issues/comments/{number}","contents_url":"https://api.github.com/repos/rozza/mongo-scala-driver/contents/{+path}","compare_url":"https://api.github.com/repos/rozza/mongo-scala-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rozza/mongo-scala-driver/merges","archive_url":"https://api.github.com/repos/rozza/mongo-scala-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rozza/mongo-scala-driver/downloads","issues_url":"https://api.github.com/repos/rozza/mongo-scala-driver/issues{/number}","pulls_url":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/rozza/mongo-scala-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/rozza/mongo-scala-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rozza/mongo-scala-driver/labels{/name}","releases_url":"https://api.github.com/repos/rozza/mongo-scala-driver/releases{/id}","created_at":"2014-03-13T11:24:55Z","updated_at":"2014-12-09T12:08:13Z","pushed_at":"2015-02-10T12:13:10Z","git_url":"git://github.com/rozza/mongo-scala-driver.git","ssh_url":"git@github.com:rozza/mongo-scala-driver.git","clone_url":"https://github.com/rozza/mongo-scala-driver.git","svn_url":"https://github.com/rozza/mongo-scala-driver","homepage":null,"size":1521,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"rozza:master","ref":"master","sha":"8ff390e5d8a3ae2f8a549d6c7cf33cb0765c9604","user":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"repo":{"id":17707682,"name":"mongo-scala-driver","full_name":"rozza/mongo-scala-driver","owner":{"login":"rozza","id":420,"avatar_url":"https://avatars.githubusercontent.com/u/420?v=3","gravatar_id":"","url":"https://api.github.com/users/rozza","html_url":"https://github.com/rozza","followers_url":"https://api.github.com/users/rozza/followers","following_url":"https://api.github.com/users/rozza/following{/other_user}","gists_url":"https://api.github.com/users/rozza/gists{/gist_id}","starred_url":"https://api.github.com/users/rozza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rozza/subscriptions","organizations_url":"https://api.github.com/users/rozza/orgs","repos_url":"https://api.github.com/users/rozza/repos","events_url":"https://api.github.com/users/rozza/events{/privacy}","received_events_url":"https://api.github.com/users/rozza/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rozza/mongo-scala-driver","description":"","fork":true,"url":"https://api.github.com/repos/rozza/mongo-scala-driver","forks_url":"https://api.github.com/repos/rozza/mongo-scala-driver/forks","keys_url":"https://api.github.com/repos/rozza/mongo-scala-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rozza/mongo-scala-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rozza/mongo-scala-driver/teams","hooks_url":"https://api.github.com/repos/rozza/mongo-scala-driver/hooks","issue_events_url":"https://api.github.com/repos/rozza/mongo-scala-driver/issues/events{/number}","events_url":"https://api.github.com/repos/rozza/mongo-scala-driver/events","assignees_url":"https://api.github.com/repos/rozza/mongo-scala-driver/assignees{/user}","branches_url":"https://api.github.com/repos/rozza/mongo-scala-driver/branches{/branch}","tags_url":"https://api.github.com/repos/rozza/mongo-scala-driver/tags","blobs_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rozza/mongo-scala-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/rozza/mongo-scala-driver/languages","stargazers_url":"https://api.github.com/repos/rozza/mongo-scala-driver/stargazers","contributors_url":"https://api.github.com/repos/rozza/mongo-scala-driver/contributors","subscribers_url":"https://api.github.com/repos/rozza/mongo-scala-driver/subscribers","subscription_url":"https://api.github.com/repos/rozza/mongo-scala-driver/subscription","commits_url":"https://api.github.com/repos/rozza/mongo-scala-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/rozza/mongo-scala-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/rozza/mongo-scala-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/rozza/mongo-scala-driver/issues/comments/{number}","contents_url":"https://api.github.com/repos/rozza/mongo-scala-driver/contents/{+path}","compare_url":"https://api.github.com/repos/rozza/mongo-scala-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rozza/mongo-scala-driver/merges","archive_url":"https://api.github.com/repos/rozza/mongo-scala-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rozza/mongo-scala-driver/downloads","issues_url":"https://api.github.com/repos/rozza/mongo-scala-driver/issues{/number}","pulls_url":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/rozza/mongo-scala-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/rozza/mongo-scala-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rozza/mongo-scala-driver/labels{/name}","releases_url":"https://api.github.com/repos/rozza/mongo-scala-driver/releases{/id}","created_at":"2014-03-13T11:24:55Z","updated_at":"2014-12-09T12:08:13Z","pushed_at":"2015-02-10T12:13:10Z","git_url":"git://github.com/rozza/mongo-scala-driver.git","ssh_url":"git@github.com:rozza/mongo-scala-driver.git","clone_url":"https://github.com/rozza/mongo-scala-driver.git","svn_url":"https://github.com/rozza/mongo-scala-driver","homepage":null,"size":1521,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/2"},"html":{"href":"https://github.com/rozza/mongo-scala-driver/pull/2"},"issue":{"href":"https://api.github.com/repos/rozza/mongo-scala-driver/issues/2"},"comments":{"href":"https://api.github.com/repos/rozza/mongo-scala-driver/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rozza/mongo-scala-driver/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/rozza/mongo-scala-driver/statuses/91e009f8a04ad17a09ca19c4a520699baa29f4b5"}}}}