MongoDB简述

时间:2021-05-11 23:45:11

简介

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling. MongoDB obviates the need for an Object Relational Mapping (ORM) to facilitate development.

MongoDB是一个开源的文档型数据库,它提供了高性能、高可用性和自动调整性。它的出现避免了ORMapping这样的机制来加快开发。

文档(Document)

A record in MongoDB is a document, which is a data structure composed of field and value pairs. MongoDB documents are similar to JSON objects. The values of fields may include other documents, arrays, and arrays of documents.

在MongoDB中一条记录就是一个文档,这种数据结构由键值对组成。MongoDB中的文档类似于Json对象。域值可以为其他的文档、数组或者文档数组。

集合(Collections)

MongoDB stores documents in collections. Collections are analogous to tables in relational databases. Unlike a table, however, a collection does not require its documents to have the same schema.

In MongoDB, documents stored in a collection must have a unique _id field that acts as a primary key.

MongoDB在集合中存储文档。集合类似于关系型数据库中的表。跟表不同的是,一个集合中的文档不要求有相同的结构。在MongoDB中,在集合中存储文档必须有一个唯一的_id域来作为主键。