This article is a brief introduction to the MongoDB database.
First, Introduction
MongoDB is an open source, non-relational database based on distributed, document-oriented storage. Non-relational databases are the most versatile and most like relational databases.
MongoDB is written in C + +, whose name comes from the word "humongous", whose purpose is to process large amounts of data.
MongoDB can run on Windows, UNIX, OSX, Solaris Systems, support 32-bit and 64-bit applications, and provide drivers for multiple programming languages.
MongoDB supports a very loose data structure, a JSON-like Bson format that stores data in the form of key-value pairs that can store complex data types.
The data types supported by MONGODB are: null, Boolean, String, ObjectId, 32-bit integer, 64-bit integer, 64-bit floating-point number, date, regular expression, JS code, binary data, array, inline document, Max, min, undefined type.
Among them, the embedded document I understand is not. Doc.txt and other files, the document referred to here is a storage unit of MongoDB (equivalent to the record in relational data), in MongoDB in the form of {key1:value1,key2:value2}, The embedded document is the form {key1:value1,key2:{key2.1:value2.1,key2.2:value2.2}}.
The biggest feature of MongoDB is that the query language he supports is very powerful, its syntax is a bit like object-oriented query language, almost can realize the most functions like relational database single table query, but also support the index of data.
Second, the characteristics of MongoDB:
1. For collection storage. Data is grouped into collections, each of which can contain an unlimited number of documents, which can be thought of as an RDBMS table, except that the collection does not require schema definitions.
2. Freedom of mode. There is no concept of rows and columns in the collection, and each document can have different key,key values that do not require a consistent data type.
3. Support Dynamic query. MongoDB supports rich query expressions, and query directives use JSON-form expressions.
4. Full index support. The query optimizer of MongoDB parses the query expression and generates an efficient query plan.
5. Efficient data storage, supporting binary data and large objects (pictures, videos, etc.).
6. Support Replication and recovery.
7. Automatic sharding to support cloud-level scalability, support for a horizontal DB cluster, and the ability to dynamically add additional servers.
Third, the application of MongoDB scenario:
1. A persistent caching layer for the information infrastructure
2. Suitable for real-time insert, update and query, and with the application of real-time data storage required for replication and high scalability
3. Storage and query for document format
4. Suitable for databases consisting of dozens of or hundreds of servers
Four, MongoDB does not apply to the scene:
1. Requires a highly transactional system. For example, a relational database is required for applications such as banks or accountants that require a lot of atomic complexity.
2. Traditional Business intelligence applications
3. Complex table-cascading queries
MongoDB Learning (a) Introduction