title: Using mongo-kafka as sink connector, how do I set a field's value to be of Date type?
body: <p>I have a mongo sink connector as well as a schema registry.</p>
  
  <p>I configured the mongo sink connector to access the schema registry similar to: <a href="https://github.com/mongodb/mongo-kafka/blob/master/docs/sink.md#configuration-example-for-avro" rel="nofollow noreferrer">https://github.com/mongodb/mongo-kafka/blob/master/docs/sink.md#configuration-example-for-avro</a></p>
  
  <p>I created a schema following this: <a href="https://github.com/mongodb/mongo-kafka/blob/master/docs/sink.md#logical-types" rel="nofollow noreferrer">https://github.com/mongodb/mongo-kafka/blob/master/docs/sink.md#logical-types</a> . It looks something like this:</p>
  
  <pre><code>{
    "type": "record",
    "name": "MyLogicalTypesRecord",
    "namespace": "com.mongodb.kafka.data.kafka.avro",
    "fields": [
      {
        "name": "myTimestampMillisField",
        "type": {
          "type": "long",
          "logicalType": "timestamp-millis"
        }
      }
    ]
  }
  </code></pre>
  
  <p>However, when the records go through, the data looks like this: <code>{ "myTimestampMillisField": 1572035138104 }</code>, instead of something similar to this <code>{ "myTimestampMillisField": ISODate("2019-10-25T20:28:19.628Z") }</code>.</p>
  
  <p>I checked the schema registry to make sure the logical type is there and that looks good.</p>
  
  <p>I'm not sure what I'm doing wrong or if there is a better way to set as Date type in mongo. Any ideas?</p>