MongoDB vs MySQL
Differences between MongoDB and MySQL on various parameters are discussed below:
What are MongoDB and MySQL?
| MongoDB | MySQL |
|---|---|
| MongoDB is an open-source database developed by MongoDB, Inc. MongoDB stores data in JSON-like documents that can vary in structure. It is a popular NoSQL database. | MySQL is a popular open-source relational database management system (RDBMS) that is developed, distributed and supported by Oracle Corporation. |
How Data is Stored?
| MongoDB | MySQL |
|---|---|
| In MongoDB, each individual records are stored as ‘documents’. | In MySQL, each individual records are stored as ‘rows’ in a table. |
HIERARCHICAL UPPER OF A RECORD
| MongoDB | MySQL |
|---|---|
| Documents belonging to a particular class or group as stored in a ‘collection’. Example: collection of users. |
A ‘table’ is used to store rows (records) of similar type. |
SQL or NoSQL
| MongoDB | MySQL |
|---|---|
| MongoDB is what is called a NoSQL database. This means that pre-defined structure for the incoming data can be defined and adhered to but also, if required different documents in a collection can have different structures. It has a dynamic schema. | MySQL as the name suggests uses Structured Query Language (SQL) for database access. The schema can not be changed. The inputs following the given schema are only entered. |
Example: In a table, if there are columns for name, address and there is need to enter ‘age’ in new column in one of the entries, it will not take it as the column is not defined in schema.
This can be achieved in MongoDB, any new field can be inserted irrespective of the schema and is thus known to have dynamic schema.
SALIENT FEATURES
| MongoDB | MySQL |
|---|---|
| MongoDB was designed with high availability and scalability in mind, and includes out-of-the-box replication and sharding. | MySQL concept does not allow efficient replication and sharding but in MySQL one can access associated data using joins which minimizes duplication. |

Mongodb MySQL feature comparison gfg
Differences in Terminology
There are differences based on terminology between MongoDB and MySQL.

Terminology Differences gfg
Data Representation
The difference between the way data is represented and stored in both the databases is quite different.
MongoDB stores data in form of JSON-like documents and MySQL stores data in form of rows of table as mentioned earlier.
Example: To show how data is stored and represented in MongoDB and MySQL.

Data Representation MongoDB vs MySQL gfg
Recommended Posts:
- MySQL | Common MySQL Queries
- MongoDB and Python
- MongoDB : An introduction
- MongoDB: Getting Started
- Difference between RDBMS and MongoDB
- Introduction about Node.js and MongoDB
- MongoDB | Create Database using MongoShell
- MongoDB | Delete Database using MongoShell
- Signup Form Using Nodejs and MongoDB
- Nodejs - Connect MongoDB with Node app using MongooseJS
- Defining, Creating and Dropping a MongoDB collection
- MongoDB python | insert(), replace_one(), replace_many()
- MongoDB Python | Insert and Update Data
- Guide to Install MongoDB with Python | Windows
- MongoDB python | Delete Data and Drop Collection
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



