MongoDB 体系结构与数据模型

Java67

MongoDB主要是由文档(document)、集合(collection)、数据库(database)这三部分组成的。类比于mysql的行、表、数据库。

MYSQL 与 MongoDB对比

MongoDB与SQL的结构对比详解

SQL Terms/Concepts MongoDB Terms/Concepts 解释与说明 database database 数据库 table collection 数据库表/集合 row document or BSON document 数据记录行/文档 column field 数据库字段/域 index index 索引 table joins embedded documents and linking 表连接,MongoDB不支持,MongoDB通过嵌入式文档来替代多表连接 primary key Specify any unique column or column combination as primary key. primary key In MongoDB, the primary key is automatically set to the _id field. 主键,MongoDB自动将_id字段设置为主键 aggregation (e.g. group by) aggregation pipeline See the SQL to Aggregation Mapping Chart.

MongoDB的最小存储单位就是文档(document)对象。文档(document)对象对应于关系型数据库的行。数据在MongoDB中以BSON ( Binary-JSON)文档的格式存储在磁盘上。

BSON ( Binary Serialized Document Format )是一种类json的一种二进制形式的存储格式,简称Binary SON。

BSON和SON一样,支持内嵌的文档对象和数组对象,但是BSON有JSON没有的一些数据类型,如Date和BinData类型。

这种格式具有灵活性高的优点,但其缺点是空间利用率不太理想。

[En]

This format has the advantage of high flexibility, but its disadvantage is that the space utilization is not very ideal.

Bson中,除了基本的SON类型:string integer,boolean,double,nullarray和object , mongo还使用了特殊的数据类型。

这些类型包括date,object idbinary data,regular expression和code。

输入验证码查看隐藏内容

扫描二维码关注本站微信公众号 Johngo学长
或者在微信里搜索 Johngo学长
回复 svip 获取验证码
wechat Johngo学长