turcsanyip commented on a change in pull request #5482:
URL: https://github.com/apache/nifi/pull/5482#discussion_r745923029



##########
File path: 
nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongoRecord.java
##########
@@ -118,15 +184,36 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
 
         final WriteConcern writeConcern = getWriteConcern(context);
 
-        List<Document> inserts = new ArrayList<>();
         int ceiling = context.getProperty(INSERT_COUNT).asInteger();
-        int added   = 0;
+        int written = 0;
         boolean error = false;
 
-        try (final InputStream inStream = session.read(flowFile);
-             final RecordReader reader = 
recordParserFactory.createRecordReader(flowFile, inStream, getLogger())) {
-            final MongoCollection<Document> collection = 
getCollection(context, flowFile).withWriteConcern(writeConcern);
+        boolean ordered = context.getProperty(ORDERED).asBoolean();
+        boolean bypass = context.getProperty(BYPASS_VALIDATION).asBoolean();
+
+        Map<String, List<String>> updateKeyFieldPathToFieldChain = new 
LinkedHashMap<>();
+        if (context.getProperty(UPDATE_KEY_FIELDS).isSet()) {
+            
Arrays.stream(context.getProperty(UPDATE_KEY_FIELDS).getValue().split("\\s*,\\s*"))
+                .forEach(updateKeyField -> updateKeyFieldPathToFieldChain.put(
+                    updateKeyField,
+                    Arrays.asList(updateKeyField.split("\\."))
+                ));
+        }

Review comment:
       You are right. I missed that it is being called in a loop.




-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to