Just a few years ago, MySQL was recognized as the king of the open source database field. However, as nosql grew at a compound growth rate of 82% per year, MySQL is facing the risk of being eliminated by nosql in the Web application market.
The migration to nosql has not only become a concern for the development trend of the IT industry, but also allows people to appreciate the open-source-driven industrial innovation, just as the storm has been approaching.
In the web application field, nosql poses a significant threat to MySQL. Although few Replace the existing application's support platform database, more and more new Web applications have chosen the path of nosql. 451 Research believes: "New projects that emphasize high scalability, performance, and flexibility use nosql database technology more ."
MongoDB is a product between relational databases and non-relational databases. It has the most abundant functions and features like relational databases. The supported data structure is very loose and is similar to the JSON bjson format. Therefore, it can store complicated data types. The biggest feature of Mongo is that it supports a very powerful query language. Its syntax is somewhat similar to an Object-Oriented Query Language. It can almost implement most of the functions similar to single-table queries in relational databases, it also supports data indexing.
It features high performance, ease of deployment, and ease of use, making it easy to store data. Features:
- It is designed for centralized storage and is easy to store object-type data.
- Free mode.
- Supports dynamic query.
- Supports full indexing, including internal objects.
- Query is supported.
- Supports replication and fault recovery.
- Use efficient binary data storage, including large objects (such as videos ).
- Automatic fragment processing to support scalability at the cloud computing level
- Supports RUBY, PYTHON, JAVA, C ++, PHP, and other languages.
- The file storage format is BSON (a json extension)
- Accessible through the network
The so-called "collenction-orented" means that data is stored in a data set by groups and is called a collection ). Each set has a unique identification name in the database and can contain an infinite number of documents. The concept of a set is similar to that of a table in a relational database service (RDBMS). The difference is that it does not need to define any schema ).
Schema-free means that we do not need to know any schema definitions for the files stored in the MongoDB database. If necessary, you can store files of different structures in the same database.
The document stored in the set is saved as a key-value pair. The key uniquely identifies a document, which is a string type, and the value can be a complex file type. We call this storage form bson (Binary serialized document format ).
The MongoDB server can run on Linux, windows, or OS X. It supports 32-bit and 64-bit applications. The default port is 27017. It is recommended to run on a 64-bit platform because MongoDB
The maximum file size supported when running in 32-Bit mode is 2 GB.
MongoDB stores data in files (the default path is/data/DB), and uses memory ing files for management to improve efficiency
MongoDB's main goal is to build a bridge between key/value storage (providing high performance and high scalability) and traditional RDBMS systems (rich functions, set the advantages of both. Mongo is applicable to the following scenarios:
1. website data: Mongo is ideal for real-time insertion, update, and query. It also supports the replication and high scalability required for real-time website data storage.
2. cache: because of its high performance, Mongo is also suitable for serving as a cache layer for information infrastructure. After the system is restarted, the persistent cache layer established by Mongo can avoid data source overload at the lower layer.
3. Large-sized and low-value data: traditional relational databases may be expensive to store some data. Previously, programmers often choose traditional files for storage.
4. high scalability: Mongo is ideal for databases consisting of dozens or hundreds of servers. The Mongo roadmap contains built-in support for the mapreduce engine.
5. Storage of objects and JSON data: The bson data format of Mongo is suitable for storing and querying document-based data.
Naturally, there are some restrictions on the use of MongoDB, for example, it is not suitable:
1. Highly transactional systems: such as banking or accounting systems. Traditional relational databases are still more suitable for applications that require a large number of atomic complex transactions.
2. Traditional Business Intelligence applications: Bi databases for specific problems will produce highly optimized query methods. For such applications, data warehouse may be a more appropriate choice.
3. SQL Problems