MongoDB 数据类型
MongoDB 将
json
格式的字符串转化为bson
格式的数据进行存储,目的是节省存储空间,但同时不会改变json的样式。
BSON is a binary serialization format used to store documents and make remote procedure calls in MongoDB.
BSON是一种二进制串行格式,这种格式在MongoDB中被存储为文档和让远程的程序调用。
一、BSON Types
Each BSON type has both integer and string identifiers as listed in the following table:
序号 | 类型 | 别名 | 备注 |
---|---|---|---|
1 | Double | "double" | |
2 | String | "string" | |
3 | Object | "object" | |
4 | Array | "array" | |
5 | Binary data | "binData" | |
6 | ObjectId | "objectId" | |
7 | Boolean | "bool" | |
8 | Date | "date" | |
9 | Null | "null" | |
10 | Regular Expression | "regex" | |
11 | JavaScript | "javascript" | |
12 | 32-bit integer | "int" | |
13 | 64-bit integer | "long" | |
14 | Timestamp | "timestamp" | |
15 | Decimal128 | "decimal" | |
16 | Min key | "minKey" | |
17 | Max key | "maxKey" |