Frage

curious what the BSON::ObjectId.id.data array represents?

for example [77, 145, 20, 13, 225, 96, 124, 5, 31, 0, 0, 1]

War es hilfreich?

Lösung

BSON::ObjectId.id.data represents 12 bytes of objectId.
Here's what exactly each byte mean:

0123   456     78   9 10 11
 ^^     ^^     ^^     ^^
time  machine  pid    inc

A BSON ObjectID is a 12-byte value consisting of a 4-byte timestamp (seconds since epoch), a 3-byte machine id, a 2-byte process id, and a 3-byte counter. Note that the timestamp and counter fields must be stored big endian unlike the rest of BSON. This is because they are compared byte-by-byte and we want to ensure a mostly increasing order.

ObjectId documentation

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top