文档
https://www.mongodb.com/docs/manual/
Getting Started — MongoDB Manual
- MongoDB 不支持事务
- MongoDB 3.2 版本及以后,使用 $lookup 进行多表查询
- MongoDB 中的键值对是有序的,相同的键值对,不同的顺序,属于不同的文档
数据类型,BSON
ObjectID 长度为 12 字节,由几个 2-4 字节的链组成。每个链代表并指定文档身份的具体内容。以下的值构成了完整的 12 字节组合:
- 一个 4 字节的值,表示自 Unix 纪元以来的秒数
- 一个 3 字节的机器标识符
- 一个 2 字节的进程 ID
- 一个 3 字节的计数器,以随机值开始,一秒内生成的计数器值唯一
保证不同时间不同机器不同进程必然唯一
时间日期
new Date()
new Date("<YYYY-mm-dd>") returns the ISODate with the specified date.
new Date("<YYYY-mm-ddTHH:MM:ss>") specifies the datetime in the client's local timezone and returns the ISODate with the specified datetime in UTC.
new Date("<YYYY-mm-ddTHH:MM:ssZ>") specifies the datetime in UTC and returns the ISODate with the specified datetime in UTC.
new Date(<integer>) specifies the datetime as milliseconds since the UNIX epoch (Jan 1, 1970), and returns the resulting ISODate instance.
mongodb限制和阈值,见官方文档
BSON文档
BSON Document Size
BSON文档的最大大小为16 MB。最大文档大小有助于确保单个文档不会使用过多的RAM或在传输过程中占用过多的带宽。要存储大于最大大小的文档,MongoDB提供了GridFS API
Nested Depth for BSON Documents
MongoDB支持BSON文档嵌套的级别不超过100
服务器参数,见官方文档
系统变量使用$$引用