{"id":29,"date":"2016-01-30T02:24:25","date_gmt":"2016-01-30T02:24:25","guid":{"rendered":"http:\/\/www.kenwalger.com\/blog\/?p=29"},"modified":"2017-07-09T22:44:31","modified_gmt":"2017-07-10T05:44:31","slug":"mongodb-and-java","status":"publish","type":"post","link":"https:\/\/www.kenwalger.com\/blog\/nosql\/mongodb-and-java\/","title":{"rendered":"MongoDB and Java CRUD operations"},"content":{"rendered":"<p>MongoDB has been out for quite a while now and with it&#8217;s 3.2 release out in Dec 2015 many of the online tutorials have become outdated as the syntax and language drivers have evolved. Let&#8217;s take a look at an introduction to the 3.2 <a href=\"https:\/\/www.mongodb.com\">MongoDB<\/a> driver in Java. We&#8217;ll cover some real basic implementation but showcase the driver syntax and some basic MongoDB documents.<\/p>\n<p>I am building this project using <a href=\"https:\/\/www.jetbrains.org\">IntelliJ 15.0.2<\/a> and utilizing Maven for dependency management. The code is available on GitHub: <a href=\"https:\/\/github.com\/kenwalger\/mongoJava\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. You will want to add the following dependency to your Maven project:<\/p>\n<pre>&lt;dependency&gt;\n    &lt;groupId&gt;org.mongodb&lt;\/groupId&gt;\n    &lt;artifactId&gt;mongo-java-driver&lt;\/artifactId&gt;\n    &lt;version&gt;3.2.1&lt;\/version&gt;\n&lt;\/dependency&gt;\n<\/pre>\n<p>We also will need a running MongoDB server. I will assume that you have MongoDB downloaded and installed on your local machine for the purposes of this tutorial. Our Java class will be accessing the MongoDB server on <code>localhost<\/code>, on the default port of <code>27017<\/code>. It is also assumed that authentication for the MongoDB server is not implemented. For information on implementing access control on a MongoDB server, take a look <a href=\"https:\/\/docs.mongodb.org\/manual\/tutorial\/enable-authentication\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p>For this introductory walk-through, we are going to be doing <em>everything<\/em> inside of our <code>main<\/code> method in our Java class. In a later post we&#8217;ll see how the project can be refactored to create methods for doing our activities.<\/p>\n<p>I want to show how to do a few important tasks with MongoDB. Namely,<\/p>\n<ul>\n<li>Connect to a database<\/li>\n<li>Insert individual documents into the database<\/li>\n<li>Insert <em>multiple<\/em> documents into the database<\/li>\n<li>Find and print documents <em>from<\/em> the database<\/li>\n<li>Update a document.<\/li>\n<li>Drop (delete) documents from the collection.<\/li>\n<li>Show how to drop an entire collection.<\/li>\n<\/ul>\n<h3><strong>Connect to a Database<\/strong><\/h3>\n<p>We need to connect to specify the <em>name<\/em> of the database to use and, if the database does not exist, MongoDB creates it for us.<\/p>\n<pre>import com.mongodb.MongoClient;\nimport com.mongodb.MongoClientURI;\nimport com.mongodb.client.MongoDatabase;\n\npublic class MongoJava {\n\n    public static void main(String[] args) {\n        try {\n            \/\/ Connect to MongoDB Server on localhost, port 27017 (default)\n            final MongoClient mongoClient = new MongoClient(new MongoClientURI(\"mongodb:\/\/localhost:27017\"));\n            \/\/ Connect to Database \"cartoon\"\n            final MongoDatabase database = mongoClient.getDatabase(\"cartoon\");\n            System.out.println(\"Successful database connection established. \\n\");\n\n        } catch (Exception exception) {\n            System.err.println(exception.getClass().getName() + \": \" + exception.getMessage());\n        }\n    }\n}\n<\/pre>\n<p>Awesome, assuming you have MongoDB up and running when we compile and run the code we will get the expected output of:<\/p>\n<pre>Successful database connection established.\n<\/pre>\n<p>Great! Now we need to put some data <em>into<\/em> our <code>cartoon<\/code> database. Let&#8217;s add a character to a <code>characters<\/code> collection. We do this by creating a BSON Document object, adding (appending) our data to that object, and then <em>insert<\/em>ing it into the collection with the <code>insertOne()<\/code> method.<\/p>\n<h3>Java Crud Operations<\/h3>\n<h4><strong>Insert Individual Documents<\/strong><\/h4>\n<p>We&#8217;ll create two new documents. One for information about <a href=\"https:\/\/www.amazon.com\/gp\/product\/B003QHU9O6\/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B003QHU9O6&amp;linkCode=as2&amp;tag=kenwalgersite-20&amp;linkId=71fcb242b4335cc06fb8531d89f2b708\" target=\"_blank\" rel=\"noopener\">Mickey Mouse<\/a><img loading=\"lazy\" decoding=\"async\" style=\"border: none !important; margin: 0px !important;\" src=\"\/\/ir-na.amazon-adsystem.com\/e\/ir?t=kenwalgersite-20&amp;l=am2&amp;o=1&amp;a=B003QHU9O6\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" \/> and one for <a href=\"https:\/\/www.amazon.com\/gp\/product\/B00J4S5HN4\/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B00J4S5HN4&amp;linkCode=as2&amp;tag=kenwalgersite-20&amp;linkId=bb306b1b98d7af84c2479a963fdb017e\" target=\"_blank\" rel=\"noopener\">Charlie Brown<\/a><img loading=\"lazy\" decoding=\"async\" style=\"border: none !important; margin: 0px !important;\" src=\"\/\/ir-na.amazon-adsystem.com\/e\/ir?t=kenwalgersite-20&amp;l=am2&amp;o=1&amp;a=B00J4S5HN4\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" \/>.<\/p>\n<h6><strong>Our import additions<\/strong><\/h6>\n<pre>import com.mongodb.ErrorCategory;\nimport com.mongodb.MongoWriteException;\nimport com.mongodb.client.MongoCollection;\n\nimport org.bson.Document;\n<\/pre>\n<h4><strong>Adding documents<\/strong><\/h4>\n<pre>            \/\/Insert a document into the \"characters\" collection.\n            MongoCollection collection = database.getCollection(\"characters\");\n\n            Document mickeyMouse = new Document();\n            Document charlieBrown = new Document();\n\n            mickeyMouse.append(\"_id\", 1)\n                    .append(\"characterName\", \"Mickey Mouse\")\n                    .append(\"creator\", new Document(\"firstName\", \"Walt\").append(\"lastName\", \"Disney\"))\n                    .append(\"pet\", \"Goofy\");\n\n            charlieBrown.append(\"_id\", 2)\n                    .append(\"characterName\", \"Charlie Brown\")\n                    .append(\"creator\", new Document(\"firstName\", \"Charles\").append(\"lastName\", \"Shultz\"))\n                    .append(\"pet\", \"Snoopy\");\n\n            try {\n                collection.insertOne(mickeyMouse);\n                collection.insertOne(charlieBrown);\n                System.out.println(\"Successfully inserted documents. \\n\");\n            } catch (MongoWriteException mwe) {\n                if (mwe.getError().getCategory().equals(ErrorCategory.DUPLICATE_KEY)) {\n                    System.out.println(\"Document with that id already exists\");\n                }\n            }\n<\/pre>\n<p>We should expect the following output:<\/p>\n<pre>Successful database connection established.\n\nSuccessfully inserted documents.\n<\/pre>\n<p>I know what you&#8217;re thinking. Are they really in there? We can go to the Mongo Shell by running <code>mongo cartoon<\/code> from a command prompt we will open a Mongo Shell and be using the cartoon database. We know that our data is in the <code>characters<\/code> collection so if we do a <code>find()<\/code> on our collection, and pretty print it with <code>db.characters.find().pretty()<\/code> we will get back our two documents.<\/p>\n<pre>{\n        \"_id\" : 1,\n        \"characterName\" : \"Mickey Mouse\",\n        \"creator\" : {\n                \"firstName\" : \"Walt\",\n                \"lastName\" : \"Disney\"\n        },\n        \"pet\" : \"Goofy\"\n}\n{\n        \"_id\" : 2,\n        \"characterName\" : \"Charlie Brown\",\n        \"creator\" : {\n                \"firstName\" : \"Charles\",\n                \"lastName\" : \"Shultz\"\n        },\n        \"pet\" : \"Snoopy\"\n}\n<\/pre>\n<p>Notice how we can have documents <em>inside<\/em> documents like the <code>creator<\/code> document. Pretty cool, eh? MongoDB allows for a rich schema design in which we can embed information inside other information. Pretty powerful.<\/p>\n<h3><strong>Maintenance and Multiple Inserts<\/strong><\/h3>\n<p>This next step we&#8217;re going to do a few things. Since we are inserting our documents with specific <code>_id<\/code> values, we can&#8217;t run it again and try to again insert <em>Mickey Mouse<\/em> into our collection as we&#8217;ll generate a <code>Duplicate Key<\/code> error. So, we&#8217;ll do a bit of maintenance at the beginning of our code to delete the current <code>characters<\/code> collection each time we run our program and yet keep the data in the database at the end.<\/p>\n<p>Let&#8217;s get some output about our collection size and also generate multiple documents using the <code>insertMany()<\/code> method of the driver. We&#8217;ll start with inserting documents starting at an <code>_id<\/code> of 3 (since we already have a 1 and 2) and generate enough so we have 50 documents in our collection.<\/p>\n<h6><strong>Our import additions<\/strong><\/h6>\n<pre>import java.util.ArrayList;\nimport java.util.List;\n<\/pre>\n<h3><strong>Multiple inserts<\/strong><\/h3>\n<pre>            \/\/ Delete the collection and start fresh - add before the initial inserts\n            collection.drop();\n\n            \n\n            \/\/ Basic data on collection\n            System.out.println(\"Collection size: \" + collection.count() + \" documents. \\n\");\n\n            \/\/ Create and insert multiple documents\n            List documents = new ArrayList();\n            for (int i = 3; i &lt; 51; i++) {\n                documents.add(new Document (\"_id\", i)\n                        .append(\"characterName\", \"\")\n                        .append(\"creator\", \"\")\n                        .append(\"pet\", \"\")\n                );\n            }\n            collection.insertMany(documents);\n\n            \/\/ Basic data on collection\n            System.out.println(\"Collection size: \" + collection.count() + \" documents. \\n\");\n<\/pre>\n<p>Very nice. Now we get some output with data about our growing collection!<\/p>\n<pre>Successful database connection established.\n\nSuccessfully inserted documents. \n\nCollection size: 2 documents. \n\nCollection size: 50 documents. \n<\/pre>\n<h3><strong>Updating Documents<\/strong><\/h3>\n<p>We should probably consider learning how to <em>update<\/em> a document as well. After all, we have 50 documents in the collection but only two of them have any useful data. We use the <code>updateOne()<\/code> method to update a single document along with the <code>$set<\/code> operator. We&#8217;ll print out the document with the <code>_id<\/code> of <code>3<\/code>, update it, and print it out again to show the change. We can find our document to print using a <code>eq<\/code> <a href=\"http:\/\/mongodb.github.io\/mongo-java-driver\/3.2\/builders\/filters\/\" target=\"_blank\" rel=\"noopener noreferrer\">Query Filter<\/a>, or <em>equals<\/em> filter.<\/p>\n<h6><strong>Our import additions<\/strong><\/h6>\n<pre>import com.mongodb.client.model.Filters;\n<\/pre>\n<h3><strong>Updates, find with filter<\/strong><\/h3>\n<pre>            \/\/ Update a document\n            \/\/ print the third document before update.\n            Document third = collection.find(Filters.eq(\"_id\", 3)).first();\n            System.out.println(third.toJson());\n\n            collection.updateOne(new Document(\"_id\", 3),\n                    new Document(\"$set\", new Document(\"characterName\", \"Dilbert\")\n                            .append(\"creator\", new Document(\"firstName\", \"Scott\").append(\"lastName\", \"Adams\"))\n                            .append(\"pet\", \"Dogbert\"))\n            );\n\n            System.out.println(\"\\nUpdated third document:\");\n            Document dilbert = collection.find(Filters.eq(\"_id\", 3)).first();\n            System.out.println(dilbert.toJson());\n\n<\/pre>\n<p>Nice work! Our output now is:<\/p>\n<pre>Successful database connection established.\n\nSuccessfully inserted documents. \n\nCollection size: 2 documents. \n\nCollection size: 50 documents. \n\nOriginal third document:\n{ \"_id\" : 3, \"characterName\" : \"\", \"creator\" : \"\", \"pet\" : \"\" }\n\nUpdated third document:\n{ \"_id\" : 3, \"characterName\" : \"Dilbert\", \"creator\" : { \"firstName\" : \"Scott\", \"lastName\" : \"Adams\" }, \"pet\" : \"Dogbert\" }\n<\/pre>\n<p>Whew! Almost there. Let&#8217;s print out the entirety of our collection. We do this with a <code>MongoCursor<\/code> and iterate over all of the documents.<\/p>\n<h6><strong>Our import additions<\/strong><\/h6>\n<pre>import com.mongodb.client.MongoCursor;\n<\/pre>\n<h3><strong>Find all with cursor<\/strong><\/h3>\n<pre>            \/\/ Find and print ALL documents in the collection\n            System.out.println(\"Print the documents.\");\n\n            MongoCursor cursor = collection.find().iterator();\n            try {\n                while (cursor.hasNext()) {\n                    System.out.println(cursor.next().toJson());\n                }\n\n            } finally {\n                cursor.close();\n            }\n<\/pre>\n<p>With all of the new output, and most of it empty, perhaps we should clean up our collection a bit. We currently have 50 documents in there, but only three of them have any pertinent data. Let&#8217;s get rid of all documents that don&#8217;t have data using the <code>deleteMany()<\/code> function. We&#8217;re going to need another filter here to delete documents whose <code>_id<\/code> is <em>greater than or equal to<\/em> <code>4<\/code>. Fortunately there is a built in filter, <code>gte<\/code> that will do just that!<\/p>\n<p>Our final code for this tutorial then is available <a href=\"https:\/\/gist.github.com\/kenwalger\/c63d57cea7f8aab24744\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> as a gist.<\/p>\n<pre>            \/\/Delete data\n            System.out.println(\"\\nDelete documents with an id greater than or equal to 4.\");\n            collection.deleteMany(Filters.gte(\"_id\", 4));\n\n            \/\/ Find and print ALL documents in the collection\n            System.out.println(\"\\nPrint all documents.\");\n\n            MongoCursor cursor2 = collection.find().iterator();\n            try {\n                while (cursor2.hasNext()) {\n                    System.out.println(cursor2.next().toJson());\n                }\n\n            } finally {\n                cursor2.close();\n            }\n\n<\/pre>\n<p>As we would expect, our collection is now left with only three documents, one each for Mickey Mouse, Charlie Brown, and <a href=\"https:\/\/www.amazon.com\/gp\/product\/B00GOC74PC\/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B00GOC74PC&amp;linkCode=as2&amp;tag=kenwalgersite-20&amp;linkId=e8109ba5541471b6b6a4b32090dc95ed\" target=\"_blank\" rel=\"noopener\">Dilbert<\/a><img loading=\"lazy\" decoding=\"async\" style=\"border: none !important; margin: 0px !important;\" src=\"\/\/ir-na.amazon-adsystem.com\/e\/ir?t=kenwalgersite-20&amp;l=am2&amp;o=1&amp;a=B00GOC74PC\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" \/>. Our final code for this tutorial then is available <a href=\"https:\/\/gist.github.com\/kenwalger\/c63d57cea7f8aab24744\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> as a gist.<\/p>\n<h3><strong>Summary<\/strong><\/h3>\n<p>We have learned quite a bit. We have seen how to connect to an active MongoDB server, create new documents, update documents, find documents in our collection, and delete documents. In the database world that is called <strong>CRUD<\/strong>, which is an acronym for <strong>C<\/strong>reate, <strong>R<\/strong>ead, <strong>U<\/strong>pdate, <strong>D<\/strong>elete. Pretty great.<\/p>\n<p>Happy coding!<\/p>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F29&#038;t=MongoDB%20and%20Java%20CRUD%20operations&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F29&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fi0.wp.com%2Fwww.kenwalger.com%2Fblog%2Fwp-content%2Fuploads%2F2016%2F01%2Fjava-mongodb-crud-e1495640606505.png%3Ffit%3D125%252C125%26ssl%3D1&#038;p&#091;title&#093;=MongoDB%20and%20Java%20CRUD%20operations\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/facebook.png?resize=48%2C48&#038;ssl=1\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F29&#038;text=Hey%20check%20this%20out\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/twitter.png?resize=48%2C48&#038;ssl=1\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-reddit nolightbox\" data-provider=\"reddit\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Reddit\" href=\"https:\/\/www.reddit.com\/submit?url=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F29&#038;title=MongoDB%20and%20Java%20CRUD%20operations\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"reddit\" title=\"Share on Reddit\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/reddit.png?resize=48%2C48&#038;ssl=1\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F29&#038;title=MongoDB%20and%20Java%20CRUD%20operations\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/linkedin.png?resize=48%2C48&#038;ssl=1\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=MongoDB%20and%20Java%20CRUD%20operations&#038;body=Hey%20check%20this%20out:%20https%3A%2F%2Fwww.kenwalger.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F29\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/96x96\/mail.png?resize=48%2C48&#038;ssl=1\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>MongoDB has been out for quite a while now and with it&#8217;s 3.2 release out in Dec 2015 many of the online tutorials have become outdated as the syntax and language drivers have evolved. Let&#8217;s take a look at an introduction to the 3.2 MongoDB driver in Java. We&#8217;ll cover some real basic implementation but &hellip; <a href=\"https:\/\/www.kenwalger.com\/blog\/nosql\/mongodb-and-java\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;MongoDB and Java CRUD operations&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":329,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pmpro_default_level":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,4,3],"tags":[],"yst_prominent_words":[190,188,201,202,199,117,189,191,203,186,197,195,194,193,200,198,187,185,192,196],"class_list":["post-29","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-mongodb","category-nosql","pmpro-has-access"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.kenwalger.com\/blog\/wp-content\/uploads\/2016\/01\/java-mongodb-crud-e1495640606505.png?fit=125%2C125&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8lx70-t","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":18,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"predecessor-version":[{"id":443,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/posts\/29\/revisions\/443"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/media\/329"}],"wp:attachment":[{"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/tags?post=29"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/www.kenwalger.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}