Mongodb sinkconnector string to date transform

Is there a way to convert yyyy-mm-dd HH:mm:ss string data into Date format of yyyy-mm-dd HH:mm:ss in mongodbsink connector?

i try

"transforms"='TimestampConverter',
   "transforms.TimestampConverter.type"='org.apache.kafka.connect.transforms.TimestampConverter$Value',
   "transforms.TimestampConverter.field"='EVENTDT',
   "transforms.TimestampConverter.format"='yyyy-MM-dd HH:mm:ss',
   "transforms.TimestampConverter.target.type"='Date',

I tried on sinkconnector in the same format as above to get Date format, but it was data in yyyy-mm-dd format.
The data I want to get is in Date format in yyyy-mm-dd HH:mm:ss format.
please help me.ㅜㅜ

What about something like:

  "transforms": "TimestampConverter",
  "transforms.TimestampConverter.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
  "transforms.TimestampConverter.format": "yyyy-MM-dd'T'HH:mm:ss'Z'",
  "transforms.TimestampConverter.target.type": "Timestamp",
  "transforms.TimestampConverter.field":"EVENTDT",
3 Likes

thank you. Changing the target type to timestamp solved it. :smiley:

2 Likes

Thank you for answer. I just have one question. I specified the target type as timestamp instead of Date, but why is it saved in Date format in MongoDB?

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.