{"id":7064,"date":"2016-02-03T08:37:50","date_gmt":"2016-02-03T07:37:50","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/"},"modified":"2016-02-03T08:37:50","modified_gmt":"2016-02-03T07:37:50","slug":"introduction-to-mongodb","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/","title":{"rendered":"Introduction to MongoDB"},"content":{"rendered":"<p>MongoDB is an open source NoSQL database management system document-oriented. MongoDB allows the manipulation of structured and unstructured data. It is schema-less and can be used to store a large data volume. This blog is explaining the main principle of the DBMS.<br \/>\nMongoDB stores data in documents. These documents are stored in BSON types, the JSON binary format. Actually, we manipulate the JSON documents in the MongoDB shell where they are encapsulated into collections. A document is composed of key-value pairs.<\/p>\n<h3>MongoDB architecture<\/h3>\n<p>Basically, MongoDB is designed to work on a cluster which distributes data across multiple servers of your architecture. You also can use MongoDB as a standalone server, without clustering. Furthermore, you can replicate your data through multiple servers. By the way, the concept of replication will be explained in an upcoming blog. MongoDB provides features and concepts, however it is important to deploy an adapted architecture which best suits your business needs.<\/p>\n<h4><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-6868 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture.png\" alt=\"MongoDB_architecture\" width=\"300\" height=\"212\" \/><\/a><\/h4>\n<h4>Why using MongoDB?<\/h4>\n<p>MongoDB provides some interesting features for your application and your architecture:<\/p>\n<ul>\n<li>Horizontal Scalability (sharding): adding more machines of increasing the performance of machines.<\/li>\n<li>High availability (replication): data durability, disaster recovery.<\/li>\n<li>Flexibility of the data model, no predictive schema, the\u00a0design of data models can be tailored for applications .<\/li>\n<li>Unstructured data can be handled<\/li>\n<\/ul>\n<h3>MongoDB Data format<\/h3>\n<pre class=\"brush: javascript; gutter: true; first-line: 1\">{\n\t\"_id\" : ObjectId(\"56951380c9b9fd993a4dc4ab\"),\n\t\"city\" : \"Del\u00e9mont\",\n\t\"zip\" : \"2800\",\n\t\"loc\" : {\n\t\t\"y\" : 47.3667,\n\t\t\"x\" : 7.3333\n\t},\n\t\"state\" : \"Jura\"\n}<\/pre>\n<p>Documents are encapsulated between two braces, and composed of key-value pairs. Every document has a unique and mandatory \u201c_id\u201d, a 12 bytes field hexadecimal number. The first 4 bytes represent the current timestamp, the next 3 bytes for the machine id, next 2 bytes for the process id (mongod) and the 3 remaining are an incremental value. This document is very interesting, aswe have a second document under the main document, which is an embedded document (there is no \u201c_id\u201d). We are going to see how to model your data in MongoDB and explain which are the differences between embedded and linked documents in the next blog. All documents are grouped into collections.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_collection.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-6869 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_collection.png\" alt=\"MongoDB_collection\" width=\"300\" height=\"230\" \/><\/a><\/p>\n<p>Terminology is important, especially to have a broader understanding of the system. Below you find a small comparison between the MongoDB and RDBMS technologies:<\/p>\n<table style=\"height: 413px\" width=\"498\">\n<tbody>\n<tr>\n<td width=\"319\">\n<h4><strong>MongoDB<\/strong><\/h4>\n<\/td>\n<td width=\"319\">\n<h4><strong>RDBMS<\/strong><\/h4>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\" width=\"319\">Collection<\/td>\n<td style=\"text-align: left\" width=\"319\">Table<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\" width=\"319\">Document<\/td>\n<td style=\"text-align: left\" width=\"319\">Row<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\" width=\"319\">Field<\/td>\n<td style=\"text-align: left\" width=\"319\">Column<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\" width=\"319\">Default <strong>_id<\/strong> field<\/td>\n<td style=\"text-align: left\" width=\"319\">Primary key<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left\" width=\"319\">Embedded documents or linked documents<\/td>\n<td style=\"text-align: left\" width=\"319\">Joins<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>In conclusion, it appears that the advantages of using MongoDB over RDBMS are multiple. To me, the design of the database schema is the most important point. With the rise of agile software development and continuous integration, the structures and data types have evolved, to the point of not being in agreement with the basic principles of relational databases. The responsibility of the data schema comes now to the software developer and not to the database management system. Compared to RDBMS classic pattern, this new storage mode allows developers to have more flexibility when it comes to evolve data schemas over time.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MongoDB is an open source NoSQL database management system document-oriented. MongoDB allows the manipulation of structured and unstructured data. It is schema-less and can be used to store a large data volume. This blog is explaining the main principle of the DBMS. MongoDB stores data in documents. These documents are stored in BSON types, the [&hellip;]<\/p>\n","protected":false},"author":109,"featured_media":7067,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[198],"tags":[399,677],"type_dbi":[],"class_list":["post-7064","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-management","tag-big-data","tag-nosql-mongodb"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Introduction to MongoDB - dbi Blog<\/title>\n<meta name=\"description\" content=\"Introduction to MongoDB, a NoSQL document store database. Architecture, data format and main features are described.\" \/>\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.dbi-services.com\/blog\/introduction-to-mongodb\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to MongoDB\" \/>\n<meta property=\"og:description\" content=\"Introduction to MongoDB, a NoSQL document store database. Architecture, data format and main features are described.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-02-03T07:37:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"625\" \/>\n\t<meta property=\"og:image:height\" content=\"442\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"DevOps\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DevOps\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/\"},\"author\":{\"name\":\"DevOps\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4cd1b5f8a3de93f05a16ab8d7d2b7735\"},\"headline\":\"Introduction to MongoDB\",\"datePublished\":\"2016-02-03T07:37:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/\"},\"wordCount\":472,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png\",\"keywords\":[\"Big Data\",\"NoSQL MongoDB\"],\"articleSection\":[\"Database management\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/\",\"name\":\"Introduction to MongoDB - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png\",\"datePublished\":\"2016-02-03T07:37:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4cd1b5f8a3de93f05a16ab8d7d2b7735\"},\"description\":\"Introduction to MongoDB, a NoSQL document store database. Architecture, data format and main features are described.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png\",\"width\":625,\"height\":442},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction to MongoDB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4cd1b5f8a3de93f05a16ab8d7d2b7735\",\"name\":\"DevOps\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g\",\"caption\":\"DevOps\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/devops\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Introduction to MongoDB - dbi Blog","description":"Introduction to MongoDB, a NoSQL document store database. Architecture, data format and main features are described.","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.dbi-services.com\/blog\/introduction-to-mongodb\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to MongoDB","og_description":"Introduction to MongoDB, a NoSQL document store database. Architecture, data format and main features are described.","og_url":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/","og_site_name":"dbi Blog","article_published_time":"2016-02-03T07:37:50+00:00","og_image":[{"width":625,"height":442,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png","type":"image\/png"}],"author":"DevOps","twitter_card":"summary_large_image","twitter_misc":{"Written by":"DevOps","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/"},"author":{"name":"DevOps","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4cd1b5f8a3de93f05a16ab8d7d2b7735"},"headline":"Introduction to MongoDB","datePublished":"2016-02-03T07:37:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/"},"wordCount":472,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png","keywords":["Big Data","NoSQL MongoDB"],"articleSection":["Database management"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/","url":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/","name":"Introduction to MongoDB - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png","datePublished":"2016-02-03T07:37:50+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4cd1b5f8a3de93f05a16ab8d7d2b7735"},"description":"Introduction to MongoDB, a NoSQL document store database. Architecture, data format and main features are described.","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/MongoDB_architecture-1.png","width":625,"height":442},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/introduction-to-mongodb\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Introduction to MongoDB"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4cd1b5f8a3de93f05a16ab8d7d2b7735","name":"DevOps","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cdd2dd7441774355062c0f0f68612296b059cd1e2ff6c7af0b15dba0ed64a85f?s=96&d=mm&r=g","caption":"DevOps"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/devops\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/7064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/109"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=7064"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/7064\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/7067"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=7064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=7064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=7064"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=7064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}