Timestamp¶
@Serializable
(with = Timestamp.Serializer::class)class Timestamp(val value: ULong) : Comparable<Timestamp>
Internal MongoDB timestamp used in the oplog.
Use the kotlin.time.Instant type for operations involving dates.
Constructors¶
Timestamp¶
constructor(value: ULong)
Constructs a timestamp from its Timestamp.instant and Timestamp.counter components.
Types¶
Companion¶
object Companion
Serializer¶
@LowLevelApi
object Serializer : KSerializer<Timestamp>
Default serializer for Timestamp.
Properties¶
counter¶
Incrementing counter.
instant¶
Date and time represented by this Timestamp, with a precision of one second.
A Timestamp can represent seconds between the UNIX epoch (Jan 1st 1970) and MAX_INSTANT.
value¶
The raw value for this Timestamp.
The first four bytes are a timestamp, the last four as an increment.
Note that this value is stored in big-endian representation, whereas the BSON specification represents timestamps in little-endian. Drivers using this type are expected to invert the endianness of this number. This implementation choice allows better sorting performance.