Introduction to MongoDB five features of MongoDB

  • 2020-05-27 07:26:57
  • OfStack

MongoDB is a powerful, flexible, and extensible way to store data. It extends many of the useful features of relational databases, such as secondary indexing, range querying, and sorting.

1.1 rich data model

MongoDB is a document-oriented database, not a relational database, and the main reason for dropping the relational model is for easier scalability, among other benefits.

The basic idea is to convert the original concept of "line "(row) into a more flexible" document "(document) model. The document-oriented approach can embed documents or arrays, so you can use one record to represent a very complex hierarchical relationship.

MongoDB has no schema: the document's keys are not pre-defined or fixed. Since no schema needs to be changed, there is usually no need to migrate large amounts of data, and instead of putting all the data in a single schema, the application layer can handle new or lost keys

1.2 easy expansion

The size of the application data set is growing rapidly. The development of sensor technology, the increase of bandwidth, and the popularity of connected internet handheld devices make it difficult for even small applications to store large amounts of data, which can be difficult for databases to process.

As developers store more and more data, they face a choice: upgrade the database (buy a better server),
Still expand the database (spreading the data across many machines). Upgrading the database is usually the most labor-saving option, but it can be expensive.

But scaling is both economical and sustainable: to increase storage space or performance, simply buy a 1-size server to join the cluster.

MongoDB initial design consider the question of extension, it USES the document-oriented data model allows it to be automatically split between multiple servers data. It can also and load balance cluster data, document automatically. So the developer can focus on writing applications, rather than thinking about how to extend. If need more capacity, only need to add new machines in the cluster, and then let the database to deal with the rest of the matter.

1.3 rich functions

a) index

MongoDB supports universal secondary indexes for a wide variety of quick queries, as well as a unique, composite, and geospatial indexing capability

Storage JavaScript b)

Instead of using stored procedures, developers can access JavaScript functions, values, directly on the server side

c) polymerization

MongoDB supports MapReduce and other aggregation tools

d) fixed set

The size of a collection is capped, which is especially useful for certain types of data, such as logs

e) file storage

MongoDB supports storing large files and file metadata using an easy-to-use protocol

MongoDB does not have some of the common features of relational databases, such as join and complex multi-line transactions.

This architectural consideration is to improve scalability, as these two functions are really difficult to implement on a distributed system.

1.4 the high performance

MongoDB USES the MongoDB transport protocol as the primary means of interacting with the server (the corresponding protocol requires more overhead, e.g., http/Rest).

It dynamically populates documents, pre-allocates data files, and trades space for performance stability. The default storage engine USES memory-mapped files to manage memory

Leave it to the operating system to handle. The dynamic query optimizer "remembers" the most efficient way to execute the query.

While MongoDB is powerful and maintains many of the features of a relational database, it does its best to leave the processing logic of the server to the client (handled by either the driver or the user's application). This streamlined design gives MongoDB excellent performance.

1.5 simple management

MongoDB try to simplify the management of database, have the server autonomous processing start the database server, almost no necessary administrative actions. If the primary server hang up, MongoDB will automatically switch to the backup server, and for active server will backup server upgrade. In a distributed environment, the cluster only needs to know how the new node, automatically integration and configuration of the new node.

The management philosophy of MongoDB is to automate the server configuration as much as possible, allowing users to adjust the Settings as needed.

The vision of MongoDB is to better interpret itself -- to build a flexible, efficient, easily extensible, fully functional database


Related articles: