MongoDB MySQL Compared

MySQL, supported by Oracle, is popular open source relational database introduced in 1995. The database follows the traditional relational model by storing data neatly into tables and by following structured query language to access the database.

MongoDB is the most popular database of a new generation of databases called NoSQL, which were built with Big Data requirements in mind. Introduced in 2007, MongoDB is currently on its 3.0 version with a soon-to-be released 3.2 version update.

MongoDB and MySQL are both open source database software but they differ in these key areas:

  • Data models: MySQL follows the tradition relational model of data stored in rows and columns within a table. You must define your schema upfront before you add any data to the system. In contrast, MongoDB has a document data model with dynamic schema. This flexible schema allows you to build an application without defining the schema first.
  • Data structure: MySQL handles structured data with data stored in rows, columns, and tables. Tables are associated through the use of joins. MongoDB is designed to handle unstructured data (e.g., texts, social media posts, video, email) with data stored in documents. Related documents are stored together as collections but documents don’t need to have identical fields to be stored in the same collection. You can also easily change the structure of a document by adding or removing new fields.
  • Scaling: MySQL, like other relational databases, requires that you use a single server to host your database. So the only way to grow is to buy a bigger, more expensive server. With MongoDB, you can increase system capacity by horizontally scaling the database over cheap, commodity servers.

MongoDB is experiencing increasing adoption because enterprises find they can satisfy the needs of Big Data applications better than with a relational technology, such as MySQL, and at a lower cost. Getting started with MongoDB is simple as documents naturally map to today’s object-oriented programming languages. The flexible data model also means that you can evolve your database schema to meet changing business requirements easily and without interruption to your applications.

Enterprises are increasingly switching to MongoDB from MySQL to build their modern applications. Find out how you can migrate your existing relational systems to MongoDB by downloading our white paper.