TimestampFormat
- Last Updated: August 12, 2024
- 1 minute read
- DataDirect Connectors
- JDBC
- MongoDB 6.1
- Documentation
Purpose
Specifies the format in which the driver renders the MongoDB composite timestamp. This property allows you to specify the format of the MongoDB composite timestamp that is most appropriate for your use case.
Valid Values
hex | bigint | bson | json | text
Behavior
If set to hex, the driver renders the bytes comprising the timestamp value as a string of hexadecimal digits, echoing the storage format. For example, 000000001407AC1A.
If set to bigint, the driver renders the timestamp as a 64-bit integer. This setting is optimal if timestamps are used for ordering the result set in chronological order. For example, 1921918923461099520.
If set to, bson, the driver renders the value in the format used for serializing as BSON, as is used in the MongoDB shell. The format is the expression:
Timestamp(<t>, <i>)
where <t> is the number of seconds since the Unix epoch, and <i> is the sequence number. For example, Timestamp(447481620, 0).
If set to json, the driver renders the value in the format used for serializing as JSON. The format is:
{"t":<t>, "i":<i>}
where <t> is the number of seconds since the Unix epoch, and <y> is the sequence number. For example, {"t":447481620, "i":0}.
If set to text, the driver renders the timestamp as a pair of values. The first is the date and time portion. The second is the sequence number. For example, 1984-03-07T04:27:00, 0.
Data Source Methods
public String getTimestampFormat()
public void setTimestampFormat(String)
Default Value
bigint
Data Type
String