Skip to content

Conversation

darthmiguel
Copy link

  • add custom schema flag to the config
  • refactor toStruct method
  • refactor toStruct implementation StringStructConverter
  • refactor toStruct implementation JsonStructConverter
  • ConverterUtils, methods to extract the schema from the record value

* add custom schema flag to the config
* refactor toStruct method
* refactor toStruct implementation StringStructConverter
* refactor toStruct implementation JsonStructConverter
* ConverterUtils, methods to extract the schema from the record value
Struct messageStruct = getStruct(message);
String topic = getTopic(message);
String db = getDB(message);
String timestamp = getTimestamp(message);
records.add(new SourceRecord(Collections.singletonMap("mongodb", db), Collections.singletonMap(db, timestamp), topic, messageStruct.schema(), messageStruct));
Object objectKey = ((Map<String, Object>) message.get("o")).get("_id");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please clean up the extraneous whitespace here and at line 152?

}

try{
customSchema = Boolean.parseBoolean(map.get(MongodbSourceConfig.CUSTOM_SCHEMA));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest making the boolean optional (check for existence with map.containsKey()), and if not specified, default to false to allow the original behavior. The new behavior will be opt-in then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants