Similar to the "lookup values in an external datasource", this mapping maps the value of a field in a MongoDB collection. To do the enrichment, a connection string, database, collection, username, password and query need to be defined.
Attribute
Required
Description
from
Y
Defines the field name before mapping.
to
Y
Defines the field name after mapping.
precedence
Y
Defines the precedence used when mapping.
Function
Y
Defines the type of mapping. Needs to be "MongoDB Enrichment".
Function type
Y
Defines the function type of the mapping. Needs to be "Enrichment/lookup functions"
connection string
Y
Defines the connection string to the database.
user
N
MongoDB user. Leave blank if the MongoDB doesn't require authentication.
password
N
MongoDB user's password. Leave blank if the MongoDB doesn't require authentication.
Database
Y
Name of the database to connect to.
Collection
Y
Name of the collection to extract data from.
query
Y
Query to be executed.
projection
N
Determines which field/s from the result to select in the output. Leave blank to get all fields.
The $value placeholder will get replaced with the value of the from field in the message.
In the following example a customer name is searched by id. The customer id value is replaced in the query to extract the customer name from the database.