Skip to content

Kotlin BSON • Multiplatform abstraction for different BSON implementationsopensavvy.ktmongo.bson.typesObjectIdObjectId

ObjectId

constructor(timestamp: Instant, processId: Long, counter: Int)

Constructs a new ObjectId from its different components.

constructor(bytes: ByteArray)

Constructs a new ObjectId by reading a byte array.

bytes should be exactly 12-bytes long.

To access the bytes of an existing ObjectId, see ObjectId.bytes.

constructor(hex: String)

Constructs a new ObjectId by reading a hexadecimal representation.

hex should be exactly 24 characters long (12 bytes).

To access the hexadecimal representation of an existing ObjectId, see ObjectId.hex.