[
https://issues.apache.org/jira/browse/BEAM-14115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17518044#comment-17518044
]
Deepal Neema commented on BEAM-14115:
-------------------------------------
Hello Team,
I have a similar kind of issue where i am trying to upsert based on two fields
i.e *vin* and *key* other than {*}_id{*}, i don't have *_id* field as this is
dynamically(automated) generated, so when ever i have the new document i want
to check with my filter keys if it's there it should update the existing one if
not insert a new one. using below code i am trying to do this:
MongoDbIO.write()
.withUri(options.getMongoDBHostName())
.withDatabase(options.getMongoDBDatabaseName())
.withCollection(collection)
.withUpdateConfiguration(UpdateConfiguration.create()
.withIsUpsert(true)
.withUpdateKey("vin")
.withUpdateKey("key")
.withUpdateFields(
UpdateField.fieldUpdate("$set", "vin",
"vin"),
UpdateField.fieldUpdate("$set", "key",
"key"),
UpdateField.fieldUpdate("$set",
"timestamp", "timestamp"),
UpdateField.fieldUpdate("$set",
"value", "value")
)
)
);
Here when i am trying to do this it's not creating *_id* field dynamically and
creating *_id* field same as *key* field
What should i do to avoid creating new _id field or how to handle this ?
Is this released or if not when are you plannning to release ?
> Update find criteria limited to _id
> -----------------------------------
>
> Key: BEAM-14115
> URL: https://issues.apache.org/jira/browse/BEAM-14115
> Project: Beam
> Issue Type: Bug
> Components: io-java-mongodb
> Affects Versions: 2.37.0
> Reporter: Olivier Le Quellec
> Priority: P2
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Documents update during write operations specify a find criteria, which is
> currently hard-coded to be on "_id" only. This is blocking for a lot
> scenarios, where we would like to upsert on a business-related document field
> By adding "findKey" in UpdateConfiguration, we can specify a find criteria on
> any field of the document. The "findKey" will default to "_id" if not
> specified
--
This message was sent by Atlassian Jira
(v8.20.1#820001)