to-timestamp
Creates a BSON timestamp from:
•A datetime value (converted to seconds since the Unix epoch).
•An ordinal value.

Languages
Built-in
Parameters
Name | Type | Description |
|---|---|---|
datetime | xs:dateTime | A datetime that will be converted to the number of seconds since the Unix epoch. |
ordinal | xs:int | An incrementing counter used to distinguish operations occurring within the same second. |
Example
This example shows how a BSON timestamp is constructed and mapped to the created field of a MongoDB component (see screenshot below). The parameters of the to-timestamp function are defined as follows:
•datetime: The constant supplies the value 2025-02-02T02:02:02.0+01:00. This value will be converted to seconds from the Unix epoch.
•ordinal: The value is generated by means of the auto-number function.

The output is as follows:
"modification": {
"created": {
"$timestamp": {
"t": 1738458122,
"i": 1
}
}
}