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--)
---