- 参考官网:mongodb数据类型
| Type | Number | Alias | Notes |
|---|---|---|---|
| Double | 1 | “double” | 双精度浮点值。用于存储浮点值。 |
| String | 2 | “string” | 字符串。存储数据常用的数据类型。在 MongoDB 中,UTF-8 编码的字符串才是合法的。 |
| Object | 3 | “object” | 用于内嵌文档。 |
| Array | 4 | “array” | 用于将数组或列表或多个值存储为一个键。 |
| Binarydata | 5 | “binData” | |
| Undefined | 6 | “undefined” | Deprecated. |
| ObjectId | 7 | “objectId” | mongodb自动生成id的类型 |
| Boolean | 8 | “bool” | 布尔值。用于存储布尔值(真/假)。 |
| Date | 9 | “date” | 时间类型 |
| Null | 10 | “null” | |
| Regular Expression | 11 | “regex” | 正则表达式类型。用于存储正则表达 |
| DBPointer | 12 | “dbPointer” | Deprecated. |
| JavaScript | 13 | “javascript” | |
| Symbol | 14 | “symbol” | Deprecated. |
| JavaScript (with scope) | 15 | “javascriptWithScope” | |
| 32-bit integer | 16 | “int” | |
| Timestamp | 17 | “timestamp” | |
| 64-bit integer | 18 | “long” | |
| Decimal128 | 19 | “decimal” | New in version 3.4. |
| Min key | -1 | “minKey” | |
| Max key | 127 | “maxKey” |
本文详细介绍了MongoDB支持的各种数据类型,包括数字、字符串、对象、数组等,并解释了每种类型的特点和用途,帮助读者更好地理解和使用MongoDB。
1231

被折叠的 条评论
为什么被折叠?



