To read data from MongoDB, configure a MongoDB V2 object as the Source transformation in a mapping.
Specify the name and description of the MongoDB V2 source. Configure the source, query options, and advanced properties for the source object. When you configure a Source transformation, you can add or remove source fields of primitive data types.
The following table describes the source properties that you can configure for a MongoDB V2 source:
Property
Description
Connection
Name of the MongoDB V2 source connection.
You can select an existing connection or create a new connection. You can also click New Parameter to define a parameter for the source connection.
Source Type
Type of the source object.
Select one of the following options:
- Single Object
- Multiple Objects¹
- Parameter
Related objects appear based on simple primary key-foreign key relationships. You can use the Advanced Relationship option to define the relationship for objects that you want to join.
Object
Name of the MongoDB V2 source object based on the source type selected.
Select the source object for a single source.
¹ Applies only to mappings in advanced mode.
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.
For more information about the complex filter conditions, see Filter formats.
You can configure filter conditions for columns of the following data types:
- Date
- Double
- Float
- Integer
- String
Select distinct rows only
Not applicable.
The following table describes the advanced properties that you can configure in a Source transformation:
Property
Description
Pre Query
Statement that you want to run before reading data from the source.
You can use only insert, update, and delete operations.
For example, if you want to insert records in the database before you read the records from the table, specify the following preSQL statement:
Amount of detail that appears in the log for this transformation.
You can use the following tracing levels:
- Terse
- Normal
- Verbose Initialization
- Verbose
Default is normal.
Joining multiple objects
When you create a Source transformation to run mappings in advanced mode, you can select multiple MongoDB V2 objects as the source type and then configure an advanced relationship to combine the tables.
Perform the following steps to join multiple objects in a Source transformation:
1In the Source transformation properties, select the Source Type as Multiple Objects.
2From the Actions menu, select Add Source Object, and then select the source object that you want to add from the displayed list.
3From the Related Objects Actions menu, select the Advanced Relationship option to define the relationship between the tables.
The following image shows an advanced relationship condition defined between MongoDB tables:
Note: You can join only two source tables. You must define only the join condition, not the complete join query.
Adding and removing source fields
You can configure the source fields that you want to use in the data flow.
You can add fields to a mapping source and retrieve a field from the source object that is not displayed in the list. To add a field, click , and then enter the field name, type, precision, and scale. You can also remove fields that you do not want to use in the mapping. To remove a field, select the field and then click .
Filter formats
Consider the following filter formats for the advanced filter option:
•Equals - { "field": "value" }
•Not equal - { "field": { "$ne": "value" } }
•Greater than - { "field": { "$gt": "value" } }
•Greater than or equal - { "field": { "$gte": "value" } }
•Less than - { "field": { "$lt": "value" } }
•Less than or equal - { "field": { "$lte": "value" } }