Github user MikeThomsen commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2560#discussion_r175286234
--- Diff:
nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/PutMongo.java
---
@@ -169,14 +208,16 @@ public void onTrigger(final ProcessContext context,
final ProcessSession session
// update
final boolean upsert =
context.getProperty(UPSERT).asBoolean();
final String updateKey =
context.getProperty(UPDATE_QUERY_KEY).getValue();
+ final String updateQuery =
context.getProperty(UPDATE_QUERY).evaluateAttributeExpressions(flowFile).getValue();
+ final Document query;
- Object keyVal = ((Map)doc).get(updateKey);
- if (updateKey.equals("_id") &&
ObjectId.isValid(((String)keyVal))) {
- keyVal = new ObjectId((String) keyVal);
+ if (!StringUtils.isBlank(updateKey)) {
+ query = parseUpdateKey(updateKey, (Map)doc);
+ removeUpdateKeys(updateKey, (Map)doc);
+ } else {
+ query = Document.parse(updateQuery);
--- End diff --
Done.
---