Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
好奇这个BSON::ObjectId.id.data数组代表什么?
BSON::ObjectId.id.data
例如[77, 145, 20, 13, 225, 96, 124, 5, 31, 0, 0, 1]
[77, 145, 20, 13, 225, 96, 124, 5, 31, 0, 0, 1]
BSON::ObjectId.id.data代表 12 个字节的 objectId。 以下是每个字节的确切含义:
0123 456 78 9 10 11 ^^ ^^ ^^ ^^ time machine pid inc
BSON ObjectID 是一个 12 字节的值,由 4 字节的时间戳(自纪元以来的秒数)、3 字节的机器 ID、2 字节的进程 ID 和 3 字节的计数器组成。请注意,时间戳和计数器字段必须以大端方式存储,这与 BSON 的其余部分不同。这是因为它们是逐字节比较的,我们希望确保大部分是递增的顺序。
ObjectId 文档