to-objectId
Creates a BSON ObjectId value using the specified datetime, random value, and ordinal (incrementing counter).

Languages
Built-in
Parameters
Name | Type | Description |
|---|---|---|
datetime | xs:dateTime | The datetime that is internally converted to UTC, then to a 4-byte timestamp (the number of seconds since the Unix epoch). |
random | xs:long | The 5-byte random value used to identify the process. |
ordinal | xs:int | The 3-byte incrementing counter used to ensure uniqueness. |
Example
This example uses the to-objectId function to construct a BSON ObjectId value and maps it to the _id field of the MongoDB component (see screenshot below). The to-objectId function receives the following input:
•datetime: 2020-02-02T02:02:02.0+01:00
•random: 100
•ordinal: the primary key value from the source DB component
As a result, the function outputs the following _id value: 5E361F8A640000000000012D. The BSON ObjectId is internally stored as a 12-byte value, but MapForce automatically converts it to a 24-character hexadecimal string for readability.
