Docs Menu
Docs Home
/
MongoDB Kafka Connector
/ /

Kafka Time Series Properties

On this page

  • Overview
  • Settings

Use the following configuration settings to specify how the MongoDB Kafka sink connector should sink data to a MongoDB time series collection.

For a list of sink connector configuration settings organized by category, see the guide on Sink Connector Configuration Properties.

Name
Description
timeseries.timefield
Type: string

Description:
The name of the top-level field in the source data that contains time information that you want to associate with the new document in the time series collection.

Default: ""
Accepted Values: An empty string or the name of a field that contains a BSON DateTime value
timeseries.timefield.auto.convert.date.format
Type: string

Description:
The date format pattern the connector should use to convert the source data contained in the field specified by the timeseries.timefield setting.

The connector passes the date format pattern to the Java DateTimeFormatter.ofPattern(pattern, locale) method to perform date and time conversions on the time field.

If the date value from the source data only contains date information, the connector sets the time information to the start of the specified day. If the date value does not contain the timezone offset, the connector sets the offset to UTC.

Default:
yyyy-MM-dd[['T'][ ]][HH:mm:ss[[.][SSSSSS][SSS]][ ]VV[ ]'['VV']'][HH:mm:ss[[.][SSSSSS][SSS]][ ]X][HH:mm:ss[[.][SSSSSS][SSS]]]
Accepted Values: A valid DateTimeFormatter format
timeseries.timefield.auto.convert
Type: boolean

Description:
Whether to convert the data in the field into the BSON Date format.

When set to true, the connector uses the milliseconds after epoch and discards fractional parts if the value is a number. If the value is a string, the connector uses the setting in the following configuration to parse the date:
timeseries.timefield.auto.convert.date.format
If the connector fails to convert the value, it sends the original value to the time series collection.

Default: false
Accepted Values: true or false
timeseries.timefield.auto.convert.locale.language.tag
Type: string

Description:
Which DateTimeFormatter locale language tag to use with the date format pattern (e.g. "en-US").

To learn more about locales, see the Java SE documentation of Locale.

Default: ROOT
Accepted Values: A valid Locale language tag format
timeseries.metafield
Type: string

Description:
Which top-level field to read from the source data to describe a group of related time series documents.

IMPORTANT: This field must not be the _id field nor the field you specified in the timeseries.timefield setting.

Default: ""
Accepted Values: An empty string or the name of a field that contains any BSON type except BsonArray.
timeseries.expire.after.seconds
Type: int

Description:
The number of seconds MongoDB should wait before automatically removing the time series collection data. The connector disables timed expiry when the setting value is less than 1.

To learn more, see Set up Automatic Removal for Time Series Collections in the MongoDB manual.

Default: 0
Accepted Values: An integer
timeseries.granularity
Type: string

Description:
The expected interval between subsequent measurements of your source data.

To learn more, see Set Granularity for Time Series Data in the MongoDB manual.

Optional
Default: ""
Accepted Values: "", "seconds", "minutes", "hours"

For an example on how to convert an existing collection to a time series collection, see the tutorial on how to Migrate an Existing Collection to a Time Series Collection.

Back

Change Data Capture Properties

On this page