{"action":"created","comment":{"url":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/comments/27409852","id":27409852,"diff_hunk":"@@ -0,0 +1,231 @@\n++++\n+date = \"2015-03-17T15:36:56Z\"\n+title = \"Async Admin Quick Tour\"\n+[menu.main]\n+  parent = \"Getting Started\"\n+  weight = 50\n+  pre = \"<i class='fa'></i>\"\n++++\n+\n+# MongoDB Driver Admin Quick Tour\n+\n+This is the second part of the MongoDB driver quick tour. In the\n+[quick tour]({{< relref \"getting-started/async-quick-tour.md\" >}}) we looked at how to\n+use the Async Java driver to execute basic CRUD operations.  In this section we'll look at some of the\n+administrative features available in the driver.\n+\n+The following code snippets come from the `QuickTourAdmin.java` example code\n+that can be found with the [driver\n+source]({{< srcref \"driver-async/src/examples/tour/QuickTourAdmin.java\">}}).\n+\n+{{% note %}}\n+See the [installation guide]({{< relref \"getting-started/installation-guide.md\" >}})\n+for instructions on how to install the MongoDB Driver.\n+{{% /note %}}\n+\n+## Setup\n+\n+To get use started we'll quickly connect and create a `mongoClient`, `database` and `collection`\n+variable for use in the examples below:\n+\n+```java\n+MongoClient mongoClient = new MongoClient(new ConnectionString(\"mongodb://localhost\"));\n+MongoDatabase database = mongoClient.getDatabase(\"mydb\");\n+MongoCollection<Document> collection = database.getCollection(\"test\");\n+```\n+\n+{{% note %}}\n+Sometimes you will need the same or similar callbacks more than once.  In these situations\n+it makes sense to DRY (Do not Repeat Yourself) up your code and save the callback either\n+as a concrete class or assign to a variable as below:\n+\n+```java\n+SingleResultCallback<Void> callbackWhenFinished = new SingleResultCallback<Void>() {\n+    @Override\n+    public void onResult(final Void result, final Throwable t) {\n+        System.out.println(\"Operation Finished!\");\n+    }\n+};\n+```\n+{{% /note %}}\n+\n+\n+## Get A List of Databases\n+\n+You can get a list of the available databases:\n+\n+```java\n+mongoClient.listDatabaseNames().forEach(new Block<String>() {\n+    @Override\n+    public void apply(final String s) {\n+        System.out.println(s);\n+    }\n+}, callbackWhenFinished);\n+```\n+\n+Calling the `getDatabase()` on `MongoClient` does not create a database.\n+Only when a database is written to will a database be created. Examples\n+would be creating an index or collection or inserting a document into a\n+collection.\n+\n+## Drop A Database\n+\n+You can drop a database by name using a `MongoClient` instance:\n+\n+```java\n+mongoClient.getDatabase(\"databaseToBeDropped\").drop(callbackWhenFinished);\n+```\n+\n+## Create A Collection\n+\n+Collections in MongoDB are created automatically simply by inserted a document into it. Using the `[createCollection]({{< apiref \"com/mongodb/client/MongoDatabase.html#createCollection-java.lang.String-\">}})` method, you can also create a collection explicitly in order to to customize its configuration. For example, to create a capped collection sized to 1 megabyte:\n+\n+```java\n+database.createCollection(\"cappedCollection\",\n+  new CreateCollectionOptions().capped(true).sizeInBytes(0x100000),\n+  callbackWhenFinished);\n+```\n+\n+## Get A List of Collections\n+\n+You can get a list of the available collections in a database:\n+\n+```java\n+database.listCollectionNames().forEach(new Block<String>() {\n+    @Override\n+    public void apply(final String databaseName) {\n+        System.out.println(databaseName);\n+    }\n+}, callbackWhenFinished);\n+```\n+\n+## Drop A Collection\n+\n+You can drop a collection by using the drop() method:\n+\n+```java\n+collection.dropCollection(call);","path":"docs/reference/content/getting-started/async-quick-tour-admin.md","position":107,"original_position":107,"commit_id":"aae7be751c49a47eb4450056cde06dc0c3d89cb7","original_commit_id":"aae7be751c49a47eb4450056cde06dc0c3d89cb7","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":"callbackWhenFinished","created_at":"2015-03-30T17:07:04Z","updated_at":"2015-03-30T17:07:04Z","html_url":"https://github.com/rozza/mongo-java-driver/pull/81#discussion_r27409852","pull_request_url":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/81","_links":{"self":{"href":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/comments/27409852"},"html":{"href":"https://github.com/rozza/mongo-java-driver/pull/81#discussion_r27409852"},"pull_request":{"href":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/81"}}},"pull_request":{"url":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/81","id":32226305,"html_url":"https://github.com/rozza/mongo-java-driver/pull/81","diff_url":"https://github.com/rozza/mongo-java-driver/pull/81.diff","patch_url":"https://github.com/rozza/mongo-java-driver/pull/81.patch","issue_url":"https://api.github.com/repos/rozza/mongo-java-driver/issues/81","number":81,"state":"open","locked":false,"title":"Updates to the getting started quick tour","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":"Including the Async Driver Quick Tour\r\n\r\nJAVA-1701 JAVA-1702","created_at":"2015-03-30T13:31:51Z","updated_at":"2015-03-30T17:07:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ebf6bcc7afce2ef06ab36fb7534d0db073401d28","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-java-driver/pulls/81/commits","review_comments_url":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/81/comments","review_comment_url":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rozza/mongo-java-driver/issues/81/comments","statuses_url":"https://api.github.com/repos/rozza/mongo-java-driver/statuses/aae7be751c49a47eb4450056cde06dc0c3d89cb7","head":{"label":"rozza:j1702","ref":"j1702","sha":"aae7be751c49a47eb4450056cde06dc0c3d89cb7","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":10246360,"name":"mongo-java-driver","full_name":"rozza/mongo-java-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-java-driver","description":"java driver for mongo","fork":true,"url":"https://api.github.com/repos/rozza/mongo-java-driver","forks_url":"https://api.github.com/repos/rozza/mongo-java-driver/forks","keys_url":"https://api.github.com/repos/rozza/mongo-java-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rozza/mongo-java-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rozza/mongo-java-driver/teams","hooks_url":"https://api.github.com/repos/rozza/mongo-java-driver/hooks","issue_events_url":"https://api.github.com/repos/rozza/mongo-java-driver/issues/events{/number}","events_url":"https://api.github.com/repos/rozza/mongo-java-driver/events","assignees_url":"https://api.github.com/repos/rozza/mongo-java-driver/assignees{/user}","branches_url":"https://api.github.com/repos/rozza/mongo-java-driver/branches{/branch}","tags_url":"https://api.github.com/repos/rozza/mongo-java-driver/tags","blobs_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rozza/mongo-java-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/rozza/mongo-java-driver/languages","stargazers_url":"https://api.github.com/repos/rozza/mongo-java-driver/stargazers","contributors_url":"https://api.github.com/repos/rozza/mongo-java-driver/contributors","subscribers_url":"https://api.github.com/repos/rozza/mongo-java-driver/subscribers","subscription_url":"https://api.github.com/repos/rozza/mongo-java-driver/subscription","commits_url":"https://api.github.com/repos/rozza/mongo-java-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/rozza/mongo-java-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/rozza/mongo-java-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/rozza/mongo-java-driver/contents/{+path}","compare_url":"https://api.github.com/repos/rozza/mongo-java-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rozza/mongo-java-driver/merges","archive_url":"https://api.github.com/repos/rozza/mongo-java-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rozza/mongo-java-driver/downloads","issues_url":"https://api.github.com/repos/rozza/mongo-java-driver/issues{/number}","pulls_url":"https://api.github.com/repos/rozza/mongo-java-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/rozza/mongo-java-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/rozza/mongo-java-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rozza/mongo-java-driver/labels{/name}","releases_url":"https://api.github.com/repos/rozza/mongo-java-driver/releases{/id}","created_at":"2013-05-23T15:06:03Z","updated_at":"2015-03-30T15:59:00Z","pushed_at":"2015-03-30T16:20:08Z","git_url":"git://github.com/rozza/mongo-java-driver.git","ssh_url":"git@github.com:rozza/mongo-java-driver.git","clone_url":"https://github.com/rozza/mongo-java-driver.git","svn_url":"https://github.com/rozza/mongo-java-driver","homepage":"","size":41460,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"rozza:master","ref":"master","sha":"a955197ea3eee8e750caf28f5a2ecfbdd915cd4a","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":10246360,"name":"mongo-java-driver","full_name":"rozza/mongo-java-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-java-driver","description":"java driver for mongo","fork":true,"url":"https://api.github.com/repos/rozza/mongo-java-driver","forks_url":"https://api.github.com/repos/rozza/mongo-java-driver/forks","keys_url":"https://api.github.com/repos/rozza/mongo-java-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rozza/mongo-java-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rozza/mongo-java-driver/teams","hooks_url":"https://api.github.com/repos/rozza/mongo-java-driver/hooks","issue_events_url":"https://api.github.com/repos/rozza/mongo-java-driver/issues/events{/number}","events_url":"https://api.github.com/repos/rozza/mongo-java-driver/events","assignees_url":"https://api.github.com/repos/rozza/mongo-java-driver/assignees{/user}","branches_url":"https://api.github.com/repos/rozza/mongo-java-driver/branches{/branch}","tags_url":"https://api.github.com/repos/rozza/mongo-java-driver/tags","blobs_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rozza/mongo-java-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/rozza/mongo-java-driver/languages","stargazers_url":"https://api.github.com/repos/rozza/mongo-java-driver/stargazers","contributors_url":"https://api.github.com/repos/rozza/mongo-java-driver/contributors","subscribers_url":"https://api.github.com/repos/rozza/mongo-java-driver/subscribers","subscription_url":"https://api.github.com/repos/rozza/mongo-java-driver/subscription","commits_url":"https://api.github.com/repos/rozza/mongo-java-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/rozza/mongo-java-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/rozza/mongo-java-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/rozza/mongo-java-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/rozza/mongo-java-driver/contents/{+path}","compare_url":"https://api.github.com/repos/rozza/mongo-java-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rozza/mongo-java-driver/merges","archive_url":"https://api.github.com/repos/rozza/mongo-java-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rozza/mongo-java-driver/downloads","issues_url":"https://api.github.com/repos/rozza/mongo-java-driver/issues{/number}","pulls_url":"https://api.github.com/repos/rozza/mongo-java-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/rozza/mongo-java-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/rozza/mongo-java-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rozza/mongo-java-driver/labels{/name}","releases_url":"https://api.github.com/repos/rozza/mongo-java-driver/releases{/id}","created_at":"2013-05-23T15:06:03Z","updated_at":"2015-03-30T15:59:00Z","pushed_at":"2015-03-30T16:20:08Z","git_url":"git://github.com/rozza/mongo-java-driver.git","ssh_url":"git@github.com:rozza/mongo-java-driver.git","clone_url":"https://github.com/rozza/mongo-java-driver.git","svn_url":"https://github.com/rozza/mongo-java-driver","homepage":"","size":41460,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/81"},"html":{"href":"https://github.com/rozza/mongo-java-driver/pull/81"},"issue":{"href":"https://api.github.com/repos/rozza/mongo-java-driver/issues/81"},"comments":{"href":"https://api.github.com/repos/rozza/mongo-java-driver/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rozza/mongo-java-driver/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/rozza/mongo-java-driver/statuses/aae7be751c49a47eb4450056cde06dc0c3d89cb7"}}}}