Stop using MongoDB!

Source: Internet
Author: User
Tags install mongodb couchdb

Stop using MongoDB!

Sven Slootweg (joepie91) is a hacker and the creator of CrytoCC. It now provides the Node. js code review service. Recently, he posted a blog post on his personal blog titled why you should never use MongoDB forever, forever, and never again. In this article, he lists the following reasons:

  • Data loss (see 1 and 2 );
  • Ignore errors by default. If the write operation is successful every time, the data may be lost silently on a 32-bit system;
  • Even in the applicable scenarios promoted by MongoDB, its performance is still not high (see figure 3 and figure 4 );
  • In almost all application scenarios, developers are forced to develop a bad habit of using the implicit mode (see figure 4 );
  • There is a lock problem (see figure 4 );
  • Slow response to security issues (see figure 5 );
  • ACID does not match (see Figure 6 );
  • Difficult to expand and maintain;
  • JSON storage is not a unique function of MongoDB, and PostgreSQL and CouchDB also support (see 7 and 8 ).

Joepie91 believes that MongoDB not only has many problems, but also has no highlights. If the project involves a certain relationship between user accounts or two records, you should use relational databases instead of document storage. If the project is using Mongoose, you should also use relational databases, because Mongoose only uses document storage to simulate a relational database with a schema. Therefore, in most cases, a relational database is actually needed. In these cases, PostgreSQL is a good option. Developers can use the Query Builder or ORM to simplify the use process. For example, in Node. js, you can use Knex, Bookshelf, sequencee, or Waterline. Even if you really need a file storage, there are better options than MongoDB. In addition, he does not think that MongoDB is suitable for prototyping, because if the production environment uses different databases, all the code needs to be rewritten. In short, MongoDB does not have any applicable scenarios. It is technically inferior to other options and does not provide truly useful unique features, and developers cannot ensure data consistency and security. Finally, joepie91 pointed out that popularity is not the same as quality. It only shows that the product has a good marketing team:

Never use a database because "others do that". For a specific database, you must study its advantages and disadvantages on your own.

Joepie91's point of view is widely accepted on Hack News. Karmakaze also believes that with PostgreSQL 9.4, there is no reason to use MongoDB (JSONB is more useful than BSON), and CouchDB can also be used. For specific restrictions on MongoDB, the user giaour suggested reading the aphyr series of articlesCall Me MaybeAnd pointed out that although there are known work S, it greatly reduces the development experience of MongoDB. Animats believes that if the site traffic is smaller than that of Wikipedia, you can use a relational database. PebblesHD has a similar view:

As a relatively small deployment ......, Is there any problem with installing only one basic MySQL? On our internal wiki, We have accessed more than 20 thousand times a day ......

But there are also some different voices. For example, threeseed, a netizen, indicates that MongoDB is still one of the easiest databases to install and use. Joepie91 replied as follows:

It's hard to do things in the wrong way-MongoDB does exactly that. It does not need to set authentication or table mode, so it looks "easy to install ". But in fact, you are wasting a few hours to save 10 minutes. Because later, you will encounter intrusion (no authentication) or data corruption ......

Shodan's report also proves joepie91's statement that nearly 30 thousand MongoDB instances on the Internet have not enabled any authentication. This problem can be seen everywhere and has existed for many years.

Toyg commented:

I recently used MongoDB for the first time in an internal project. In my opinion, no mode actually significantly improves the development speed ...... Now that the project is mature, I can see why relational databases are more suitable. But if I use RDBMS from the very beginning, I may not be able to complete the migration so quickly. Although switching to the real RDBMS means to modify three or two classes, the change is not big. Therefore, I do not agree that MongoDB is not suitable for prototype development.

Joepie91 raises a question about the statement "modifying three or two classes but not significantly changing", because migrating to different databases usually requires a lot of work based on your own experience in code review. As for the switching speed, joepie91 points out that a system with a rollback mechanism may be faster.

However, in some cases, developers have no other options. For example, some netizens suggested that Meteor can only be used with MongoDB. Due to its partnership with Hadoop, MongoDB is well integrated with Hadoop, so it is very popular in the field of big data analysis.

In addition, Eric Sink, a software developer from SourceGear, said after reading the joepie91 article:

Some (maybe all) of the content he lists does. In fact, now, let's assume that what he wrote is correct. I am not saying that the author is wrong. More specifically, I would like to point out that such blog posts only allow me to know little about MongoDB, but make me feel a lot of emotions of people who write this blog.

He believes that MongoDB cannot be completely rejected because of those problems. after all:

MongoDB is a top NoSQL vendor. Every day, thousands of enterprises use it to provide services to millions of users. Like all new software that has a large number of users, it has vulnerabilities and defects. But it is improving steadily. If any discussion about technical defects does not help solve the problem, it can only be an emotional catharsis to a large extent.

MongoDB 3.0 official version released and downloaded

CentOS compilation and installation of MongoDB

CentOS compilation and installation of php extensions for MongoDB and mongoDB

CentOS 6 install MongoDB and server configuration using yum

Install MongoDB2.4.3 in Ubuntu 13.04

MongoDB beginners must read (both concepts and practices)

MongoDB Installation Guide for Ubunu 14.04

MongoDB authoritative Guide (The Definitive Guide) in English [PDF]

Nagios monitoring MongoDB sharded cluster service practice

Build MongoDB Service Based on CentOS 6.5 Operating System

MongoDB details: click here
MongoDB: click here

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.