{"id":1310,"date":"2019-03-15T13:37:24","date_gmt":"2019-03-15T08:07:24","guid":{"rendered":"http:\/\/blog.openwebsolutions.in\/?p=1310"},"modified":"2019-03-15T17:02:14","modified_gmt":"2019-03-15T11:32:14","slug":"mongodb-vs-mysql-differences-explained","status":"publish","type":"post","link":"https:\/\/openwebsolutions.in\/blog\/mongodb-vs-mysql-differences-explained\/","title":{"rendered":"MongoDB VS MySQL( The Differences Explained)"},"content":{"rendered":"<p>Mysql has become popular options for organizations around the globe\u00a0for the past two decades when there is a requirement for the relational database. However, when diversity and volume of data have increased with time, most of the developers prefer a non-relational database like MongoDB.<\/p>\n<h2><strong>How Data is Stored?<\/strong><\/h2>\n<p>MongoDB is an open-source database which is developed by MongoDB Inc. MongoDB stores data in JSON data format. Mainly, it is more like Binary JSON format(BSON).<\/p>\n<p>Whereas Mysql is a popular open-source relational database management system (RDBMS) that is developed and maintained by Oracle Corporation. MySQL stores data into tables using the structured query language (SQL) to access the data.<\/p>\n<p><strong>Hierarchical upper of a record:<\/strong><\/p>\n<p>In MongoDB, all documents belong to a particular class or groups and it is stored in collections.<\/p>\n<p>Example: collection of user.<\/p>\n<p>In Mysql, a \u2018table\u2019 is used to store rows (records) of similar type.<\/p>\n<p><strong>SQL or NoSQL:<\/strong><\/p>\n<p>Suppose in a table, if there are any columns named \u201cname\u201d, \u201caddress\u201d and there is to add a new field as \u201cage\u201d, it will not be taken as \u201cage is not defined in schema.<\/p>\n<p>But in MongoDB, any new field can be inserted irrespective of the schema and thus it is known as a dynamic schema.<\/p>\n<h3><strong>Differences in Terminology:<\/strong><\/h3>\n<p>There are several differences in terminology between MongoDB and MySQL.<\/p>\n<p><strong>MySQL MongoDB<\/strong><\/p>\n<p>Table Collections<\/p>\n<p>Row Document<\/p>\n<p>Column Field<\/p>\n<p>Join Embedded documents, linking<\/p>\n<p><strong>Data Representation:<\/strong><\/p>\n<p>The way data is represented and stored in both Mysql and MongoDB databases is quite different.<\/p>\n<p>A document in MongoDB<\/p>\n<p>{<\/p>\n<p>name: \u201cSudip\u201d,<\/p>\n<p>middle_name: \u201ckiran\u201d,<\/p>\n<p>surname: \u201cDas\u201d<\/p>\n<p>contact: \u201c1234567890\u201d<\/p>\n<p>}<\/p>\n<p>A record in Mysql<\/p>\n<p>name middle-name surname contact<\/p>\n<p>Sudip Kiran Das 1234567890<\/p>\n<h3><strong>How are their queries different:<\/strong><\/h3>\n<p><em>Selecting records from the customer table:<\/em><\/p>\n<p align=\"left\"><strong>MySQL:<\/strong> SELECT * FROM customer<\/p>\n<p align=\"left\"><strong>MongoDB:<\/strong> db.customer.find()<\/p>\n<p align=\"left\"><em>Inserting records into the customer table:<\/em><\/p>\n<p align=\"left\"><strong>MySQL:<\/strong> INSERT INTO customer (cust_id, branch, status) VALUES (&#8216;cust_01&#8217;, &#8216;A&#8217;, \u2018Active\u2019)<\/p>\n<p align=\"left\"><strong>MongoDB:<\/strong> db.customer.insert({ cust_id: &#8216;cust_01&#8217;, branch: &#8216;A&#8217;, status: &#8216;Active&#8217; })<\/p>\n<p><em>Updating records in the customer table:<\/em><\/p>\n<p align=\"left\"><strong>MySQL:<\/strong>\u00a0UPDATE customer SET branch = &#8216;development&#8217; WHERE cust_id = \u2018 cust_01\u2019<\/p>\n<p align=\"left\"><strong>MongoDB:<\/strong>\u00a0db.customer.update( { cust_id: \u2018cust_01\u2019 }, { $set: { branch: &#8216;development&#8217; } } )<\/p>\n<h2 class=\"western\" align=\"left\">Which Database Is Right For Your Business?<\/h2>\n<p align=\"left\">When you are making the choice between MySQL and MongoDB, there are several types of factors to consider:<\/p>\n<p><strong>MySQL:<\/strong> Any type of application that requires multi-row transactions such as an accounting system, should be better suited for a relational database. MongoDB is not a suitable option to deploy for this particular case.<\/p>\n<p><strong>MongoDB:<\/strong> MongoDB will be well-suited for real-time analytics, content management, the internet of things, mobile, and other types of applications that are new and can take advantage of what MongoDB offers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mysql has become popular options for organizations around the globe\u00a0for the past two decades when there is a requirement for the relational database. However, when diversity and volume of data have increased with time, most of the developers prefer a non-relational database like MongoDB. How Data is Stored? MongoDB is an open-source database which is [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":1381,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[103,102],"tags":[105,104],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MongoDB VS MySQL( The Differences Explained)<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/openwebsolutions.in\/blog\/mongodb-vs-mysql-differences-explained\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MongoDB VS MySQL( The Differences Explained)\" \/>\n<meta property=\"og:description\" content=\"Mysql has become popular options for organizations around the globe\u00a0for the past two decades when there is a requirement for the relational database. However, when diversity and volume of data have increased with time, most of the developers prefer a non-relational database like MongoDB. How Data is Stored? MongoDB is an open-source database which is [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/openwebsolutions.in\/blog\/mongodb-vs-mysql-differences-explained\/\" \/>\n<meta property=\"og:site_name\" content=\"Openweb Solutions Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-15T08:07:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-15T11:32:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2019\/03\/Untitled-design.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/\",\"name\":\"Openweb Solutions Blog\",\"description\":\"Transforming ideas into reality\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/openwebsolutions.in\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/mongodb-vs-mysql-differences-explained\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2019\/03\/Untitled-design.png\",\"width\":1200,\"height\":628},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/mongodb-vs-mysql-differences-explained\/#webpage\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/mongodb-vs-mysql-differences-explained\/\",\"name\":\"MongoDB VS MySQL( The Differences Explained)\",\"isPartOf\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/mongodb-vs-mysql-differences-explained\/#primaryimage\"},\"datePublished\":\"2019-03-15T08:07:24+00:00\",\"dateModified\":\"2019-03-15T11:32:14+00:00\",\"author\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/6ee4fc2ee24f409dd20a38c2e316f5b9\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/openwebsolutions.in\/blog\/mongodb-vs-mysql-differences-explained\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/6ee4fc2ee24f409dd20a38c2e316f5b9\",\"name\":\"Sudip Kiran Das\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a5a98bccb7b3949ed32d74c92048925b?s=96&r=g\",\"caption\":\"Sudip Kiran Das\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/1310"}],"collection":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/comments?post=1310"}],"version-history":[{"count":4,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/1310\/revisions"}],"predecessor-version":[{"id":1384,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/1310\/revisions\/1384"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media\/1381"}],"wp:attachment":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media?parent=1310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/categories?post=1310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/tags?post=1310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}