Introduction to MongoDBMongoDB简介
On this page本页内容
Document Database文档数据库
A record in MongoDB is a document, which is a data structure composed of field and value pairs. MongoDB中的记录是一个文档,它是一个由字段和值对组成的数据结构。MongoDB documents are similar to JSON objects. MongoDB文档类似于JSON对象。The values of fields may include other documents, arrays, and arrays of documents.字段的值可以包括其他文档、数组和文档数组。
The advantages of using documents are:使用文档的优势在于:
Documents correspond to native data types in many programming languages.文档对应于许多编程语言中的本机数据类型。Embedded documents and arrays reduce need for expensive joins.嵌入式文档和数组减少了对昂贵联接的需求。Dynamic schema supports fluent polymorphism.动态模式支持流畅多态性。
Collections/Views/On-Demand Materialized Views集合/视图/按需实体化视图
MongoDB stores documents in collections. Collections are analogous to tables in relational databases.MongoDB将文档存储在集合中。集合类似于关系数据库中的表。
In addition to collections, MongoDB supports:除了集合之外,MongoDB还支持:
Read-only Views (Starting in MongoDB 3.4)只读视图(从MongoDB 3.4开始)On-Demand Materialized Views按需物化视图(Starting in MongoDB 4.2).(从MongoDB 4.2开始)。
Key Features主要功能
High Performance高性能
MongoDB provides high performance data persistence. In particular,MongoDB提供了高性能的数据持久性。特别地,
Support for embedded data models reduces I/O activity on database system.对嵌入式数据模型的支持减少了数据库系统上的I/O活动。Indexes support faster queries and can include keys from embedded documents and arrays.索引支持更快的查询,并且可以包括来自嵌入文档和数组的键。
Query API查询API
The MongoDB Query API supports read and write operations (CRUD) as well as:MongoDB Query API支持读写操作(CRUD)以及:
See also: 另请参阅:
SQL to MongoDB Mapping ChartSQL到MongoDB的映射图SQL to Aggregation Mapping ChartSQL到聚合映射图Learn about the latest query language features with the MongoDB Query Language: What's New了解MongoDB查询语言的最新查询语言功能:MongoDB Live 2020的最新演示presentation from MongoDB.live 2020.
。
High Availability高可用性
MongoDB's replication facility, called replica set, provides:MongoDB的复制工具,称为副本集,提供:
automatic failover自动故障转移data redundancy.数据冗余。
A replica set is a group of MongoDB servers that maintain the same data set, providing redundancy and increasing data availability.副本集是一组MongoDB服务器,它们维护相同的数据集,提供冗余并提高数据可用性。
Horizontal Scalability水平可扩展性
MongoDB provides horizontal scalability as part of its core functionality:MongoDB提供横向可扩展性作为其核心功能的一部分:
Sharding distributes data across a cluster of machines.分片将数据分布在一组机器上。Starting in 3.4, MongoDB supports creating zones of data based on the shard key.从3.4开始,MongoDB支持基于分片键创建数据区域。In a balanced cluster, MongoDB directs reads and writes covered by a zone only to those shards inside the zone.在一个平衡的集群中,MongoDB只将区域覆盖的读写定向到区域内的分片。See the Zones manual page for more information.有关详细信息,请参阅分区手册页面。
Support for Multiple Storage Engines支持多个存储引擎
MongoDB supports multiple storage engines:MongoDB支持多种存储引擎:
WiredTiger Storage EngineWiredTiger存储引擎(including support for Encryption at Rest)(包括对静止加密的支持)In-Memory Storage Engine.内存存储引擎。
In addition, MongoDB provides pluggable storage engine API that allows third parties to develop storage engines for MongoDB.此外,MongoDB提供了可插拔存储引擎API,允许第三方为MongoDB开发存储引擎。