Recently consider the transfer of order history data from Oracle database to NoSQL database for historical data query and analysis, one day tens data, intends to use the MongoDB database, using Nodejs to do query and statistics API, the demand for concurrent requests low, do not know if there is a predecessor so played, We now only use Mongodo to store log data for application failure analysis. If you have predecessors doing a similar historical database query and data analysis, you can exchange the NoSQL libraries and the upper-level development language you choose.
1.mongodb Introduction
MongoDB (named from "Humongous") is a scalable, high-performance, open-source, schema-free, document-oriented database. It is written using C + +. MongoDB Features:
A. Collection-oriented storage: suitable for storing objects and data in JSON form.
B. Dynamic query: MONGO supports rich query representations, and query directives use JSON-style markup to easily query embedded objects and arrays in a document.
C. Full index support: Includes embedded objects and arrays in the document. The query optimizer of MONGO parses the query expression and generates an efficient query plan.
D. Query monitoring: MONGO contains a monitoring tool for analyzing database operational performance.
E. Replication and automatic failover: The MONGO database supports replication of data between servers, supporting master-slave mode and inter-server replication. The primary purpose of replication is to provide redundancy and automatic failover.
F. Efficient traditional storage: supports binary data and large objects such as photos or pictures.
G. Auto-sharding to support cloud-level scalability: Automatic sharding supports a level of database clustering, adding additional machines dynamically.
2.mongo Use Cases
The main goal of MongoDB is to set up a bridge between key/value storage (which provides high performance and high scalability) as well as traditional RDBMS systems (rich functionality), combining the advantages of both. The MONGO is suitable for the following scenarios:
A. Website data: MONGO is ideal for real-time inserts, updates and queries, as well as the replication and high scalability required for real-time data storage on the site.
B. Caching: Because of its high performance, MONGO is also suitable as a caching layer for the information infrastructure. After the system restarts, the persistent cache built by MONGO can avoid overloading the underlying data sources.
C. Large-size, low-value data: It may be expensive to store some data using a traditional relational database, before which many programmers often choose to store traditional files.
D. Highly scalable scenario: The MONGO is ideal for databases consisting of dozens of or hundreds of servers.
E. Storage for objects and JSON data: The MONGO Bson data format is ideal for storing and querying document formats.
Not suitable for the scene:
A. A highly functional system: such as a bank or accounting system. The traditional relational database is still more suitable for applications that require a large number of atomic complex transactions.
B. Traditional business intelligence applications: a BI database for a specific problem will produce highly optimized query methods. For such applications, the Data warehouse may be a more appropriate choice.
C. A problem that requires SQL.
MongoDB applicable and non-applicable application scenarios