[
https://issues.apache.org/jira/browse/BEAM-12400?focusedWorklogId=618330&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-618330
]
ASF GitHub Bot logged work on BEAM-12400:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 03/Jul/21 05:03
Start Date: 03/Jul/21 05:03
Worklog Time Spent: 10m
Work Description: pareshsarafmdb commented on a change in pull request
#14927:
URL: https://github.com/apache/beam/pull/14927#discussion_r663318281
##########
File path:
sdks/java/io/mongodb/src/main/java/org/apache/beam/sdk/io/mongodb/MongoDbIO.java
##########
@@ -910,15 +973,24 @@ public void startBundle() {
public void processElement(ProcessContext ctx) {
// Need to copy the document because mongoCollection.insertMany() will
mutate it
// before inserting (will assign an id).
+
batch.add(new Document(ctx.element()));
if (batch.size() >= spec.batchSize()) {
- flush();
+ if (spec.isUpdate()) {
Review comment:
@aromanenko-dev @pabloem Have checked in the changes. We have an
UpdateConfiguration object where all the update related details are wrapped.
Sample below:
MongoDbIO.write().withUri(options.getMongoDBUri())
.withDatabase(options.getDatabase())
.withCollection(options.getCollection()).withUpdateConfiguration(
UpdateConfiguration.create().withUpdateKey("accId").withUpdateFields(
UpdateField.of("$set", "category",
"category"),
UpdateField.of("$set","balance",
"balance"),
UpdateField.of("$push",
"transactions"))
Last update which is a push does update the dest field with full input
document. Please review and let me know.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 618330)
Remaining Estimate: 166h 10m (was: 166h 20m)
Time Spent: 1h 50m (was: 1h 40m)
> Improve MongoDBIO for beam - add update capability
> --------------------------------------------------
>
> Key: BEAM-12400
> URL: https://issues.apache.org/jira/browse/BEAM-12400
> Project: Beam
> Issue Type: Improvement
> Components: io-java-mongodb
> Reporter: Paresh Saraf
> Assignee: Paresh Saraf
> Priority: P2
> Original Estimate: 168h
> Time Spent: 1h 50m
> Remaining Estimate: 166h 10m
>
> Right now mongodbio supports only inserts/overwrites to a collections. In
> many cases it will be usually updating an existing document: setting a field
> or pushing into an array. BulkUpdate capability to be added as part part of
> MongoDBIo->Write
--
This message was sent by Atlassian Jira
(v8.3.4#803005)