{"id":1418,"date":"2012-06-08T19:00:00","date_gmt":"2012-06-08T19:00:00","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/2012\/10\/mapreduce-with-mongodb.html"},"modified":"2012-10-22T05:40:48","modified_gmt":"2012-10-22T05:40:48","slug":"mapreduce-with-mongodb","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html","title":{"rendered":"MapReduce with MongoDB"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left\">MapReduce is a software framework introduced by Google in 2004 to support distributed computing on large data sets on clusters of computers. You can read about MapReduce from              <a href=\"http:\/\/en.wikipedia.org\/wiki\/MapReduce\">here<\/a>.             <\/p>\n<p>MongoDB is an open source document-oriented NoSQL database system written in C++. You can read more about MongoDB from              <a href=\"http:\/\/en.wikipedia.org\/wiki\/MongoDB\">here<\/a>.             <\/p>\n<p><strong>1. Installing MangoDB.             <\/strong><\/p>\n<div style=\"text-align: justify\">Follow the instructions from the MongoDB official documentation available              <a href=\"http:\/\/www.mongodb.org\/display\/DOCS\/Quickstart\">here<\/a>. In my case, I followed the instructions for OS X and it worked fine with no issues.             <\/div>\n<div style=\"text-align: justify\">\n<\/div>\n<div style=\"text-align: justify\">I used              <strong>sudo port install mongodb<\/strong> to install MongoDB and one issue I faced was regarding to the xcode version I had. Basically I installed xcode while I was in OS X Leopard and didn&#8217;t update the xcode to the latest after moving to Lion. Once I updated the xcode, I could install mongodb with MacPort with no issue. Another hint &#8211; sometime your xcode installation doesn&#8217;t work fine when you directly install it from the App Store &#8211; what you could do is, get xcode from the App Store and then go to the Launch Pad, find Install Xcode and install it from there.             <\/div>\n<p><strong>2. Running MongoDB             <\/strong><\/p>\n<div style=\"text-align: justify\">Starting MongoDB is simple..             <\/div>\n<div style=\"text-align: justify\">\n<\/div>\n<div style=\"text-align: justify\">Just type              <strong>mogod<\/strong> in the terminal or in your command console.             <\/div>\n<div style=\"text-align: justify\">\n<\/div>\n<div style=\"text-align: justify\">By default this will start the MongoDB server on 27017 and will use the \/data\/db\/ directory to store data &#8211; yes, that is directory that you created in step &#8211; 1.             <\/div>\n<div style=\"text-align: justify\">\n<\/div>\n<div style=\"text-align: justify\">In case you want to change those default settings &#8211; you can do it while starting the server.             <\/div>\n<div style=\"text-align: justify\">\n<\/div>\n<div style=\"text-align: justify\"><strong>mongod &#8211;port [your_port] &#8211;dbpath [your_db_file_path]<\/strong>            <\/div>\n<div style=\"text-align: justify\">\n<\/div>\n<div style=\"text-align: justify\">You need to make sure that your_db_file_path exists and its empty when you start the server for the first time&#8230;             <\/div>\n<p><strong>3. Starting MongoDB shell             <\/strong><\/p>\n<div style=\"text-align: justify\">We can start MongoDB shell &#8211; to connect it to our MongoDB server and run commands from there.             <\/div>\n<div style=\"text-align: justify\">\n<\/div>\n<div style=\"text-align: justify\">To start the MongoDB shell to connect to the MongoDB server running on the same machine with the default ports you only need to type              <strong>mongo<\/strong> in the command line. If you are running MongoDB server on a different machine with a different port use the following.             <\/div>\n<div style=\"text-align: justify\">\n<\/div>\n<p><strong>mongo [ip_address]:[port]<\/strong><br \/>\n<strong>e.g : mongo localhost:4000<\/strong>            <div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><strong>4. Let&#8217;s create a Database first.             <\/strong><\/p>\n<p>In the MangoDB shell type the following&#8230;             <\/p>\n<pre class=\"brush:java\">&gt; use library\r\n<\/pre>\n<p>The above is supposed to create a database called &#8216;library&#8217;.             <\/p>\n<p>Now to see whether your database been created, just type the following &#8211; which is supposed to list all the databases.             <\/p>\n<pre class=\"brush:java\">&gt; show dbs;<\/pre>\n<div style=\"text-align: justify\">You will notice that the database that you just created is not listed there. The reason is, MongoDB creates databases on-demand. It will get created only when we add something to it.             <\/div>\n<p><strong>5. Inserting data to MongoDB.             <\/strong><\/p>\n<p>Let&#8217;s first create two books with the following commands.             <\/p>\n<pre class=\"brush:java\">&gt; book1 = {name : \"Understanding JAVA\", pages : 100}\r\n&gt; book2 = {name : \"Understanding JSON\", pages : 200}<\/pre>\n<p>Now, let&#8217;s insert these two books in to a collection called books.             <\/p>\n<pre class=\"brush:java\">&gt; db.books.save(book1)\r\n&gt; db.books.save(book2)<\/pre>\n<p>The above two statements will create a collection called books under the database library. Following statement will list out the two books which we just saved.             <\/p>\n<pre class=\"brush:java\">&gt; db.books.find();\r\n\r\n{ \"_id\" : ObjectId(\"4f365b1ed6d9d6de7c7ae4b1\"), \"name\" : \"Understanding JAVA\", \"pages\" : 100 }\r\n{ \"_id\" : ObjectId(\"4f365b28d6d9d6de7c7ae4b2\"), \"name\" : \"Understanding JSON\", \"pages\" : 200 }<\/pre>\n<p>Let&#8217;s add few more records.             <\/p>\n<pre class=\"brush:java\">&gt; book = {name : \"Understanding XML\", pages : 300}\r\n&gt; db.books.save(book)\r\n&gt; book = {name : \"Understanding Web Services\", pages : 400}\r\n&gt; db.books.save(book)\r\n&gt; book = {name : \"Understanding Axis2\", pages : 150}\r\n&gt; db.books.save(book)<\/pre>\n<p><strong>6. Writing the Map function             <\/strong><\/p>\n<p>Let&#8217;s process this library collection in a way that, we need to find the number of books having pages less 250 pages and greater than that.             <\/p>\n<pre class=\"brush:java\">&gt; var map = function() {\r\nvar category;\r\nif ( this.pages &gt;= 250 ) \r\ncategory = 'Big Books';\r\nelse \r\ncategory = \"Small Books\";\r\nemit(category, {name: this.name});\r\n};<\/pre>\n<p>Here, the collection produced by the Map function will have a collection of following members.             <\/p>\n<pre class=\"brush:java\">{\"Big Books\",[{name: \"Understanding XML\"}, {name : \"Understanding Web Services\"}]);\r\n{\"Small Books\",[{name: \"Understanding JAVA\"}, {name : \"Understanding JSON\"},{name: \"Understanding Axis2\"}]);<\/pre>\n<p><strong>7. Writing the Reduce function.             <\/strong><\/p>\n<pre class=\"brush:java\">&gt; var reduce = function(key, values) {\r\nvar sum = 0;\r\nvalues.forEach(function(doc) {\r\nsum += 1;\r\n});\r\nreturn {books: sum};\r\n};<\/pre>\n<p><strong>8. Running MapReduce against the books collection.             <\/strong><\/p>\n<pre class=\"brush:java\">&gt; var count  = db.books.mapReduce(map, reduce, {out: \"book_results\"});\r\n&gt; db[count.result].find()\r\n\r\n{ \"_id\" : \"Big Books\", \"value\" : { \"books\" : 2 } }\r\n{ \"_id\" : \"Small Books\", \"value\" : { \"books\" : 3 } } <\/pre>\n<p>The above says, we have 2 Big Books and 3 Small Books.             <\/p>\n<p>Everything done above using the MongoDB shell, can be done with Java too. Following is the Java client for it. You can download the required dependent jar from              <a href=\"http:\/\/people.wso2.com\/~prabath\/facilelogin\/mongo.jar\">here<\/a>.             <\/p>\n<pre class=\"brush:java\">import com.mongodb.BasicDBObject;\r\nimport com.mongodb.DB;\r\nimport com.mongodb.DBCollection;\r\nimport com.mongodb.DBObject;\r\nimport com.mongodb.MapReduceCommand;\r\nimport com.mongodb.MapReduceOutput;\r\nimport com.mongodb.Mongo;\r\n\r\npublic class MongoClient {\r\n\r\n \/**\r\n  * @param args\r\n  *\/\r\n public static void main(String[] args) {\r\n\r\n  Mongo mongo;\r\n  \r\n  try {\r\n   mongo = new Mongo(\"localhost\", 27017);\r\n   DB db = mongo.getDB(\"library\");\r\n\r\n   DBCollection books = db.getCollection(\"books\");\r\n\r\n   BasicDBObject book = new BasicDBObject();\r\n   book.put(\"name\", \"Understanding JAVA\");\r\n   book.put(\"pages\", 100);\r\n   books.insert(book);\r\n   \r\n   book = new BasicDBObject();  \r\n   book.put(\"name\", \"Understanding JSON\");\r\n   book.put(\"pages\", 200);\r\n   books.insert(book);\r\n   \r\n   book = new BasicDBObject();\r\n   book.put(\"name\", \"Understanding XML\");\r\n   book.put(\"pages\", 300);\r\n   books.insert(book);\r\n   \r\n   book = new BasicDBObject();\r\n   book.put(\"name\", \"Understanding Web Services\");\r\n   book.put(\"pages\", 400);\r\n   books.insert(book);\r\n \r\n   book = new BasicDBObject();\r\n   book.put(\"name\", \"Understanding Axis2\");\r\n   book.put(\"pages\", 150);\r\n   books.insert(book);\r\n   \r\n   String map = \"function() { \"+ \r\n             \"var category; \" +  \r\n             \"if ( this.pages &gt;= 250 ) \"+  \r\n             \"category = 'Big Books'; \" +\r\n             \"else \" +\r\n             \"category = 'Small Books'; \"+  \r\n             \"emit(category, {name: this.name});}\";\r\n   \r\n   String reduce = \"function(key, values) { \" +\r\n                            \"var sum = 0; \" +\r\n                            \"values.forEach(function(doc) { \" +\r\n                            \"sum += 1; \"+\r\n                            \"}); \" +\r\n                            \"return {books: sum};} \";\r\n   \r\n   MapReduceCommand cmd = new MapReduceCommand(books, map, reduce,\r\n     null, MapReduceCommand.OutputType.INLINE, null);\r\n\r\n   MapReduceOutput out = books.mapReduce(cmd);\r\n\r\n   for (DBObject o : out.results()) {\r\n    System.out.println(o.toString());\r\n   }\r\n  } catch (Exception e) {\r\n   \/\/ TODO Auto-generated catch block\r\n   e.printStackTrace();\r\n  }\r\n }\r\n}\r\n<\/pre>\n<p><strong><i>Reference: <\/i><\/strong><a href=\"http:\/\/blog.facilelogin.com\/2012\/02\/mapreduce-with-mongodb.html\">MapReduce with MongoDB <\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Prabath Siriwardena at the <a href=\"http:\/\/blog.facilelogin.com\/\">Facile Login<\/a> blog.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>MapReduce is a software framework introduced by Google in 2004 to support distributed computing on large data sets on clusters of computers. You can read about MapReduce from here. MongoDB is an open source document-oriented NoSQL database system written in C++. You can read more about MongoDB from here. 1. Installing MangoDB. Follow the instructions &hellip;<\/p>\n","protected":false},"author":174,"featured_media":187,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[112],"class_list":["post-1418","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-mongodb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MapReduce with MongoDB - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"MapReduce is a software framework introduced by Google in 2004 to support distributed computing on large data sets on clusters of computers. You can read\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MapReduce with MongoDB - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"MapReduce is a software framework introduced by Google in 2004 to support distributed computing on large data sets on clusters of computers. You can read\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-06-08T19:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-10-22T05:40:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Prabath Siriwardena\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prabath Siriwardena\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html\"},\"author\":{\"name\":\"Prabath Siriwardena\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/37957613753faeced7560c9ccf27aec5\"},\"headline\":\"MapReduce with MongoDB\",\"datePublished\":\"2012-06-08T19:00:00+00:00\",\"dateModified\":\"2012-10-22T05:40:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html\"},\"wordCount\":604,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/mongodb-logo.jpg\",\"keywords\":[\"MongoDB\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html\",\"name\":\"MapReduce with MongoDB - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/mongodb-logo.jpg\",\"datePublished\":\"2012-06-08T19:00:00+00:00\",\"dateModified\":\"2012-10-22T05:40:48+00:00\",\"description\":\"MapReduce is a software framework introduced by Google in 2004 to support distributed computing on large data sets on clusters of computers. You can read\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/mongodb-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/mongodb-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/06\\\/mapreduce-with-mongodb.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"MapReduce with MongoDB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/37957613753faeced7560c9ccf27aec5\",\"name\":\"Prabath Siriwardena\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a557892ef8e489b814adf1a42f1d61fde7a40c42f7c5ab44402590d76f52b6ab?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a557892ef8e489b814adf1a42f1d61fde7a40c42f7c5ab44402590d76f52b6ab?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a557892ef8e489b814adf1a42f1d61fde7a40c42f7c5ab44402590d76f52b6ab?s=96&d=mm&r=g\",\"caption\":\"Prabath Siriwardena\"},\"sameAs\":[\"http:\\\/\\\/blog.facilelogin.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Prabath-Siriwardena\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MapReduce with MongoDB - Java Code Geeks","description":"MapReduce is a software framework introduced by Google in 2004 to support distributed computing on large data sets on clusters of computers. You can read","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html","og_locale":"en_US","og_type":"article","og_title":"MapReduce with MongoDB - Java Code Geeks","og_description":"MapReduce is a software framework introduced by Google in 2004 to support distributed computing on large data sets on clusters of computers. You can read","og_url":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-06-08T19:00:00+00:00","article_modified_time":"2012-10-22T05:40:48+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","type":"image\/jpeg"}],"author":"Prabath Siriwardena","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Prabath Siriwardena","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html"},"author":{"name":"Prabath Siriwardena","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/37957613753faeced7560c9ccf27aec5"},"headline":"MapReduce with MongoDB","datePublished":"2012-06-08T19:00:00+00:00","dateModified":"2012-10-22T05:40:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html"},"wordCount":604,"commentCount":5,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","keywords":["MongoDB"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html","url":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html","name":"MapReduce with MongoDB - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","datePublished":"2012-06-08T19:00:00+00:00","dateModified":"2012-10-22T05:40:48+00:00","description":"MapReduce is a software framework introduced by Google in 2004 to support distributed computing on large data sets on clusters of computers. You can read","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/mongodb-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/06\/mapreduce-with-mongodb.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"MapReduce with MongoDB"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/37957613753faeced7560c9ccf27aec5","name":"Prabath Siriwardena","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a557892ef8e489b814adf1a42f1d61fde7a40c42f7c5ab44402590d76f52b6ab?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a557892ef8e489b814adf1a42f1d61fde7a40c42f7c5ab44402590d76f52b6ab?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a557892ef8e489b814adf1a42f1d61fde7a40c42f7c5ab44402590d76f52b6ab?s=96&d=mm&r=g","caption":"Prabath Siriwardena"},"sameAs":["http:\/\/blog.facilelogin.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Prabath-Siriwardena"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/174"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1418"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1418\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/187"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=1418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}