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]