Operation comparison table and difference between mongodb and MySQL

Time:2020-1-24

Both MySQL and mongodb are common open-source databases, but MySQL is a traditional relational database, mongodb is a non relational database, also known as a document database, which is a NoSQL database. They have their own advantages. The key is to see where they are used. So the well-known SQL statements are not applicable to mongodb, because SQL statements are the standard language for relational databases.
 
Take our company’s project as an example. In early projects, we used relational databases, SQL server, Oracle, DB2, and then all turned to MySQL. The reason is simple: MySQL has the advantage of open source when its performance is good. The transactional and high performance of MySQL are our main considerations. Later, because the project needs to use the user system, that is, there will be a large number of user data for interaction – mass storage, MySQL’s reading and writing speed will have a little bottleneck, so we think of NoSQL, which has developed strongly recently. With the development of the early Memcache of NoSQL, there are many non relational databases, such as redis and mongodb. After a period of testing, the read and write speed of redis and mongodb is indeed better than that of Mysql. Mongodb’s write speed is about 2.5w/second.
 
Mongodb uses bson structure (binary) for storage, which has obvious advantages for mass data storage. The following is a comparison of mongodb and MySQL operation commands.

Note in particular: mongodb inserts multiple fields syntax

>Db.user.insert ({ID: 1, name: ‘Steve’, sex: ‘male’}) is correct
>DB. User. Insert ({ID: 2}, {Name: ‘bear’}, {sex: ‘male’}) error

Recommended Today

Rust and python: why rust can replace Python

In this guide, we compare the rust and python programming languages. We will discuss the applicable use cases in each case, review the advantages and disadvantages of using rust and python, and explain why rust might replace python. I will introduce the following: What is rust? What is Python? When to use rust When to […]