Introduction

What is MySQL?

What is MongoDB?

MySQL vs MongoDB 2017: side-by-side comparison

MySQL MongoDB

Written in C++, C C++, C and JavaScript

Type RDBMS Document-oriented

Main points Table

Row



Column Collection

Document



Field

License GPL v2 / Commercial licenses available OD GNU AGPL v3.0 / Commercial licenses available OD

Schemas Strict Dynamic

Scaling Vertically Horizontally

Key features Full-text searching and indexing

Integrated replication support



Triggers

SubSELECTs

Query caching

SSL support

Unicode support

Different storage engines with various performance characteristics Auto-sharding

Native replication



In-memory speed

Embedded data models support

Comprehensive secondary indexes

Rich query language support

Various storage engines support

Best used for Data structure fits for tables and rows

Strong dependence on multi-row transactions



Frequent updates and modifications of large volume of records

Relatively small datasets High write loads

Unstable schema



Your DB is set to grow big

Data is location based

HA (high availability) in unstable environment is required

No database administrators (DBAs)

Examples NASA, US Navy, Bank of Finland, UCR, Walmart, Sony, S2 Security Corporation, Telenor, Italtel, iStock, Uber, Zappos, Booking.com, Twitter, Facebook, others. Expedia, Bosch, Otto, eBay, Gap, Forbes, Foursquare, Adobe, Intuit, Metlife, BuzzFeed, Crittercism, CitiGroup, the City of Chicago, others.



MySQL vs MongoDB: pros and cons

MySQL pros MongoDB pros

Atomic transactions support

JOIN support



Mature solution

Privilege and password security system Document validation

Integrated storage engines



Shortened time between primary failure and recovery

MySQL cons MongoDB cons

Tough scaling

Stability concerns



Isn't community-driven development Not the best option for apps with complex transactions

Not a snap-in replacement for legacy solutions



Young solution



Which database to choose?

The relational databases held the leadership for decades and at that time the choice was quite obvious, either MySQL, Oracle, or MS SQL, just to name a few. They've served as a basis for tons of enterprise applications, while modern apps require more diversity and scalability. Non-relational databases, like MongoDB, have appeared to meet the existing requirements and replace current relational environment.is a full-featured open-source relational database management system (RDBMS) that was originally built by MySQL AB and currently owned by Oracle Corporation. It stores data in tables that are grouped into a database, uses Structured Query Language (SQL) to access data and such commands as 'SELECT', 'UPDATE', 'INSERT' and 'DELETE' to manage it. Related information can be stored in different tables, but the usage of JOIN operation allows you to correlate it, perform queries across various tables and minimize the chance of data duplication.MySQL is compatible with nearly all operating systems, namely Windows, Linux, Unix, Apple, FreeBSD and many others. It supports various storage engines, like InnoDB (it is the default one), Federated, MyISAM, Memory, CSV, Archive, Blackhole and Merge.is a popular open-source document-oriented database developed by 10gen, later called the MongoDB Inc. In this case, documents are created and stored in BSON files, Binary JSON (JavaScript Object Notation) format, so all JS types of data are supported. That being the case, MongoDB is often applied for Node.js projects. Besides of that, JSON enables transferring data between servers and web apps with the use of the human-readable format. It is also a better option, when it comes to storage capacity and speed, as it offers greater efficiency and reliability.One of the top benefits offered by MongoDB is the use of dynamic schemas that eliminates the need to pre-define the structure, like fields or value types. Such model allows hierarchical relationships representation, array storage, and ability to change the records structure by simply adding or deleting fields. This NoSQL solution comes with embedding, auto-sharding, and on-board replication for better scalability and high availability.Related article: Databases in Details: How to Choose the Right One? Comparing MongoDB vs MySQL performance is difficult, since both management systems are extremely useful and the core differences underlie their basic operations and initial approach. However, MongoDB vs MySQL is a hot argument that is going on for a while now: mature relational database against a young non-relational system. Both are open-source and easily available, as well as both systems offer commercial versions with tons of additional features.MongoDB attracts users with its open and simple philosophy, as well as the collaborative and helpful community, while users report the exact opposite regarding MySQL, after Oracle's acquisition. Another issue with the latter one is owner's focus on MariaDB development along with refuse to accept community patches and to provide sustainability plan. These factors have resulted in a standstill, though MySQL is still the go-to solution for multiple companies worldwide.Interesting to read: Top 5 Knowledge Management Software for Startups. Does Your Company Need a Custom One? Comparing MongoDB speed vs MySQL, developers note that the latter one lacks speed and experience difficulties with large data volumes, so it'll be a better choice for companies with smaller databases and looking for a more general solution. While this is one of the advantages of MongoDB over MySQL: the ability to cope with large and unstructured amounts of data.To answer the main question: “when to use MongoDB instead of MySQL?” you need to take into account your project requirements and further goals. MySQL is well-recognized for its high performance, flexibility, reliable data protection, high availability, and management ease. Proper data indexing can solve the issue with performance, facilitate interaction and ensure robustness. But if your data is unstructured and complex, or if you can't pre-define your schema, you'd better opt for MongoDB. And what is more, if you need to handle a large volume of data and store it as documents – MongoDB will help you to meet the challenges.