Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2123#discussion_r140531630
--- Diff:
nifi-nar-bundles/nifi-standard-services/nifi-mongodb-services-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java
---
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.mongodb;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.lookup.LookupFailureException;
+import org.apache.nifi.lookup.LookupService;
+import org.apache.nifi.reporting.InitializationException;
+import org.apache.nifi.serialization.SimpleRecordSchema;
+import org.apache.nifi.serialization.record.MapRecord;
+import org.apache.nifi.serialization.record.Record;
+import org.apache.nifi.serialization.record.RecordField;
+import org.apache.nifi.serialization.record.RecordFieldType;
+import org.apache.nifi.serialization.record.RecordSchema;
+import org.bson.Document;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+
+@Tags({"mongo", "mongodb", "lookup", "record"})
+@CapabilityDescription(
+ "Provides a lookup service based around MongoDB. Each key that is
specified \n" +
+ "will be added to a query as-is. For example, if you specify the two
keys, \n" +
+ "user and email, the resulting query will be { \"user\": \"tester\",
\"email\": \"[email protected]\" }.\n" +
+ "The query is limited to the first result (findOne in the Mongo
documentation). If no \"lookup key\" is specified " +
+ "then the entire Mongo result document minus the _id field will be
returned as a record and merged."
+)
+public class MongoDBLookupService extends MongoDBControllerService
implements LookupService<Object> {
+
+ public static final PropertyDescriptor LOOKUP_KEY = new
PropertyDescriptor.Builder()
--- End diff --
This doesn't appear to be used as a lookup key, it looks like a Lookup
Value Field or something, the name of the field whose value is returned when
the lookup key matches a record. Can you explain a bit more about this
property, how its used, etc. not just in the PR but in the documentation? I was
quite confused about its usage and wasn't able to test it successfully until I
configured it as a Lookup Value Field
---