MongoDB Connector > Mappings and Mapping Tasks with MongoDB > MongoDB sources in mappings
  

MongoDB sources in mappings

To read data from MongoDB, configure a MongoDB object as the Source transformation in a mapping.
Specify the name and description of the MongoDB source. Configure the source, query options, and advanced properties for the source object.
The following table describes the source properties that you can configure for a MongoDB source:
Property
Description
Connection
Name of the MongoDB source connection.
Source Type
Type of the MongoDB source objects available. Select one of the following types:
  • - Single Object. Reads from a single object.
  • - Multiple Objects. Reads from multiple objects. Related objects appear based on simple primary key-foreign key relationship. You can use the Advanced Relationship option to define the relationship for objects that you want to join.
  • - Query. Not applicable.
  • - Parameter. Parameterizes the object name. You can configure the source object in a mapping task associated with a mapping that uses this source transformation.
You can read data from a single MongoDB source object, multiple objects, or parameterize the object.
Object
Name of the MongoDB source object based on the source type selected.
Filter
Configure a simple filter or an advanced filter to remove rows at the source. You can improve efficiency by filtering early in the data flow.
A simple filter includes a field name, operator, and value. Use an advanced filter to define a more complex filter condition, which can include multiple conditions using the AND or OR logical operators.
The following table describes the query options that you can configure in a Source transformation:
Property
Description
Filter
Filter value in a read operation. Click Configure to add conditions to filter records and reduce the number of rows that the Secure Agent reads from the source.
You can specify the following filter conditions:
  • - Not parameterized. Use a basic filter to specify the object, field, operator, and value to select specific records.
  • - Completely parameterized. Use a parameter to represent the field mapping.
  • - Advanced. Use an advanced filter to define a more complex filter condition on an object.
You can configure filter conditions for columns of the following data types:
  • - Date
  • - Double
  • - Float
  • - Integer
  • - String
Sort
Sorts records based on the conditions you specify.
Click Configure to add conditions to sort records and reduce the number of rows that the Secure Agent reads from the source.
You can specify the following sort conditions:
  • - Not parameterized. Select the fields and type of sorting to use.
  • - Parameterized. Use a parameter to specify the sort option.
The following table describes the advanced properties that you can configure for a MongoDB source:
Property
Description
preSQL
SQL statement that you want to run before reading data from the source.
For example, if you want to insert records in the database before you read the records from the table, specify the following preSQL statement:
INSERT INTO cloud.employees ("name", "uid") VALUES('James', 2012)
postSQL
SQL statement that you want to run after reading data from the source.
For example, if you want to update records in a table after you read the records from a table, specify the following postSQL statement:
UPDATE cloud.employees
SET uid = 2011 WHERE uid=2014
You can set the tracing level in the advanced properties to determine the amount of detail that appears in the logs.
The following table describes the tracing levels that you can configure:
Property
Description
Terse
The Secure Agent logs initialization information, error messages, and notification of rejected data.
Normal
The Secure Agent logs initialization and status information, errors encountered, and skipped rows due to transformation row errors. Summarizes session results, but not at the level of individual rows.
Verbose Initialization
In addition to normal tracing, the Secure Agent logs additional initialization details, names of index and data files used, and detailed transformation statistics.
Verbose Data
In addition to verbose initialization tracing, the Secure Agent logs each row that passes into the mapping. Also notes where the Secure Agent truncates string data to fit the precision of a column and provides detailed transformation statistics.
When you configure the tracing level to verbose data, the Secure Agent writes row data for all rows in a block when it processes a transformation.