[
https://issues.apache.org/jira/browse/NIFI-4948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16391340#comment-16391340
]
ASF GitHub Bot commented on NIFI-4948:
--------------------------------------
Github user MikeThomsen commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2522#discussion_r173176691
--- Diff:
nifi-nar-bundles/nifi-standard-services/nifi-mongodb-services-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBControllerService.java
---
@@ -69,9 +70,10 @@ public boolean exists(Document query) {
return this.col.count(query) > 0;
}
+ @Override
public Document findOne(Document query) {
MongoCursor<Document> cursor =
this.col.find(query).limit(1).iterator();
- Document retVal = cursor.next();
+ Document retVal = cursor.tryNext();
--- End diff --
Ok, this looks right based on the [official
documentation](http://api.mongodb.com/java/current/com/mongodb/client/MongoCursor.html#tryNext--)
> MongoDB Lookup Service throws an exception if there is no match
> ---------------------------------------------------------------
>
> Key: NIFI-4948
> URL: https://issues.apache.org/jira/browse/NIFI-4948
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.5.0
> Reporter: Pierre Villard
> Assignee: Pierre Villard
> Priority: Major
>
> The LookupRecord processor states that in case of no match in the lookup
> service, the FF will be routed either to success or to unmatched (depending
> on the strategy). At the moment the MongoDB lookup service throws an
> exception in case there is no match. It causes the FF to be routed to failure.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)