Hello MongoDB community!,
I am working on Mongodb Source Connectors
The below document comes via change stream and then get pushed to kafka. The requirement is to convert the timestamp to string date format “yyyy-MM-dd” and/or “yyyy-MM-dd’T’HH:mm:ss.SSSXXX”.
{
“_id”: “448906BD1”,
“Balance”: {
“AmountDue”: 390.39,
“DueDate”: 1676091600000,
“LastUpdatedAtSource”: 1675241617000,
“MinimumAmountDue”: 390.39
},
“DocKey”: 1,
“DocumentDate”: “1675241617000”
}
When converting the ‘DocumentDate’ at root level the conversion works.
The following is the portion of the configuration .
"transforms": "DocumentDate,DueDate",
"transforms.DocumentDate.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
"transforms.DocumentDate.format": "yyyy-MM-dd",
"transforms.DocumentDate.target.type": "string",
"transforms.DocumentDate.field": "DocumentDate"
The same conversion does not work for the ‘DueDate’ and ‘LastUpdatedAtSource’ which are inside the Balance object
Here is the configuration for the ‘DueDate’ conversion.
"transforms.DueDate.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
"transforms.DueDate.format": "yyyy-MM-dd",
"transforms.DueDate.target.type": "string",
"transforms.DueDate.field": "Balance.DueDate"
Please point me to correct config setting
Thanks in advance
Bala