-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented a new id strategy in the Sink Connector #87
base: master
Are you sure you want to change the base?
Conversation
…ct id as string in a field and then it will be converted to ObjectId inside the connector
hi, thanks for the PR @crossleyjuan , we have exactly the same need / constraints in our actual product. Any guys in the mongodb core team can evaluate this pr / need ? |
@crossleyjuan That's really great !! Waiting to be merged :) |
@@ -0,0 +1,20 @@ | |||
# MongoDB Kafka BsonObjectId | |||
|
|||
This implementaion allows the MongoDB Kafka sink connector to convert an existing _id that is string as ObjectId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementaion allows the MongoDB Kafka sink connector to convert an existing _id that is string as ObjectId | |
This implementation allows the MongoDB Kafka sink connector to convert an existing _id that is string as ObjectId |
VALUE | ||
} | ||
|
||
private ProvidedIn where; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private ProvidedIn where; | |
private final ProvidedIn where; |
Hi there, |
|
||
abstract class BsonOidProvidedStrategy implements IdStrategy { | ||
|
||
protected enum ProvidedIn { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about headers?
() -> | ||
new DataException( | ||
"Provided id strategy is used but the document structure either contained" | ||
+ " no _id field or it was null")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clarify: no top-level field
Hi team, |
Recently I'd a request from my customer where they explained that when the _id is provided in the kafka stream there's no way to convert this to ObjectId to keep it consistent with the other records in the collection, checking the different Id Providers it looks like there's no implementation of the ObjectId when it's provided, as such I've implemented a custom Id Provider that receives the string either in the Key or in the Value and converts this to an ObjectId, this way the customer will keep consistency with the previous records created using standard driver.