The original address: http://www.mongoing.com/archives/3609

Use case

  • Case 1

    1. Logging for application servers is more flexible to find than text and easy to export. Also for the application practice, starting from the peripheral system using MongoDB.
    2. It is used in obtaining or capturing some third-party information. Because of the schema-less of MongoDB, all formats are flexible, and there is no need to design a unified format for information with different formats, which greatly reduces the development work.
  • Case 2

    MongoDB has been used before, mainly used to store some monitoring data, No schema for developers, it is really convenient, increase the field does not need to change the table structure, and learning cost is very low.

  • Case 3

    Using MongoDB to make O2O express application, the information of Courier riders and express merchants (including location information) is stored in MongoDB, and then the geographical location of MongoDB is queried. In this way, it is very convenient to find nearby merchants and riders and other functions, so that the Courier riders can receive orders nearby. At present, I have not encountered any major problems in using MongoDB. The official website documents are more detailed and very powerful.

Mongo features

When I often discuss MongoDB business scenarios with some students, I will hear voices like “you can solve this scenario with mysql, there is no need to use MongoDB”. Indeed, there is no business scenario that needs to be solved with MongoDB. However, using MongoDB usually allows you to solve problems at a lower cost (including learning, development, operation, etc.). Here are the main features of MongoDB that you can look at against your business needs. The more matches you have, the more suitable you will be using MongoDB.

Mongo features advantage
Transaction support MongoDB currently only supports single document transactions. Scenarios requiring complex transaction support are not suitable for the time being.
Flexible document model JSON format stores the closest object model to the real world, which is developer-friendly and facilitates rapid development iterations.
Highly available replication set Meet the requirements of high data reliability and high service availability, simple operation and maintenance, automatic failover of faults.
Scalable shard cluster Massive data storage, service capacity level expansion.
A high performance Mmapv1, WiredTiger, Mongorocks (Rocksdb), and In-memory support various scenarios
Powerful index support Location index can be used to build various O2O applications, text index to meet the needs of search, TTL index to meet the needs of automatic expiration of historical data.
Gridfs Address file storage requirements
aggregation & mapreduce To meet the requirements of data analysis scenarios, users can write their own query statements or scripts and send requests to MongoDB.

Whether MongoDB should be used

From the current users of Aliyun MongoDB cloud database, MongoDB applications have penetrated into various fields, such as games, logistics, e-commerce, content management, social networking, Internet of things, live video, etc. The following are several practical application cases.

  • Game scene, use MongoDB to store game user information, user equipment, points and other directly embedded document form storage, convenient query, update.
  • In logistics scenario, MongoDB is used to store order information, and the order status will be updated continuously during the delivery process. The order status is stored in the form of MongoDB embedded array, and all changes of the order can be read out in a single query.
  • In social networking scenarios, MongoDB storage is used to store user information and the information published by users in the circle of friends, and the nearby people and places are realized through geographical location index.
  • In the Internet of Things scenario, MongoDB is used to store information about all connected smart devices and log information reported by the devices, and analyze the information in multiple dimensions.
  • Live video, use MongoDB to store user information, gift information, etc.

If you’re still trying to decide whether or not to use MongoDB, here are a few multiple-choice questions to help you decide.

Application features YES / NO
Applications do not require transaction and complex join support Must be Yes
New applications, requirements will change, data model can not be determined, want rapid iterative development ?
Applications require more than 2000-3000 read/write QPS (higher is acceptable) ?
Applications require TB or even PB data storage ?
Applications grow rapidly and need to scale horizontally quickly ?
The application requires that the stored data not be lost ?
Applications need to be 99.999% high availability ?
The application needs a lot of geographical location query, text query ?

If you have one Yes, consider MongoDB. If you have two or more Yes, you will never regret choosing MongoDB.


If you feel that you have gained something after reading it, please click “like”, “follow” and add the official account “Niumi Technology” to read more wonderful history!! :