tMongoDBOutput Properties - 6.1

Talend Open Studio for Big Data Components Reference Guide

EnrichVersion
6.1
EnrichProdName
Talend Open Studio for Big Data
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

Component family

Big Data / MongoDB

 

Function

tMongoDBOutput inserts, updates, upserts or deletes documents in a MongoDB database collection based on the incoming flow from the preceding component in the Job.

Purpose

This component executes the action defined on the collection in the MongoDB database.

Basic settings

Use existing connection

Select this check box and in the Component List click the relevant connection component to reuse the connection details you already defined.

 

DB Version

List of the database versions.

Available when the Use existing connection check box is not selected.

 

Use replica set address

Select this check box to show the Replica address table.

In the Replica address table, you can define multiple MongoDB database servers for failover.

Available when the Use existing connection check box is not selected.

 

Server and Port

IP address and listening port of the database server.

Available when the Use existing connection or Use replica set address check box is not selected.

 

Database

Name of the database.

 

Use SSL connection

Select this check box to enable the SSL encrypted connection.

Then you need to use the tSetKeystore component in the same Job to specify the authentication information.

For further information about tSetKeystore, see tSetKeystore.

Note that the SSL connection is available only for the version 2.4 + of MongoDB.

 

Set write concern

Select this check box to perform the MongoDB Write Concern operation. Then you need to select the level of this operation.

For further information, see the related MongoDB documentation on http://docs.mongodb.org/manual/core/write-concern/.

 

Bulk write

Select this check box to insert, update or remove data in bulk. Note this feature is available only when the version of MongoDB you are using is 2.6+.

Then you need to select Ordered or Unordered to define how the MongoDB database processes the data sent by the Studio.

  • If you select Ordered, MongoDB processes the queries sequentially.

  • If you select Unordered, MongoDB processes the queries in parallel.

In the Bulk write size field, enter the size of each query group to be processed by MongoDB. In the documentation of MongoDB, some restrictions and expected behaviors as to this size are explained. You can find the details on http://docs.mongodb.org/manual/core/bulk-write-operations/.

 

Required authentication

Select this check box to enable the database authentication.

 

Username and Password

DB user authentication data.

To enter the password, click the [...] button next to the password field, and then in the pop-up dialog box enter the password between double quotes and click OK to save the settings.

Available when the Required authentication check box is selected.

If the security system you have selected from the Authentication mechanism drop-down list is Kerberos, you need to enter the User principal, the Realm and the KDC server fields instead of the Username and the Password fields.

 

Collection

Name of the collection in the MongoDB database.

 

Drop collection if exist

Select this check box to drop the collection if it already exists.

 

Action on data

The following operations are available:

Insert: insert data.

Set: update part of the data. If you need to apply this action on all the documents in the collection to be used, select the Update all document check box that is displayed; otherwise, only the first document is updated.

Update: update data.

Upsert: update and insert data if the element does not exist.

Upsert with set: set or insert data if the element does not exist. If you need to apply this action on all the documents in the collection to be used, select the Update all document check box that is displayed; otherwise, only the first document is updated.

Delete: delete data.

 

Schema and Edit Schema

A schema is a row description. It defines the number of fields (columns) to be processed and passed on to the next component. The schema is either Built-In or stored remotely in the Repository.

Click Edit schema to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this option to view the schema only.

  • Change to built-in property: choose this option to change the schema to Built-in for local changes.

  • Update repository connection: choose this option to change the schema stored in the repository and decide whether to propagate the changes to all the Jobs upon completion. If you just want to propagate the changes to the current Job, you can select No upon completion and choose this schema metadata again in the [Repository Content] window.

Click Sync columns to retrieve the schema from the previous component connected in the Job.

 

 

Built-In: You create and store the schema locally for this component only. Related topic: see Talend Studio User Guide.

 

 

Repository: You have already created the schema and stored it in the Repository. You can reuse it in various projects and Job designs. Related topic: see Talend Studio User Guide.

When the schema to be reused has default values that are integers or functions, ensure that these default values are not enclosed within quotation marks. If they are, you must remove the quotation marks manually.

For more details, see https://help.talend.com/display/KB/Verifying+default+values+in+a+retrieved+schema.

 

Mapping

Specify the parent node for the column in the MongoDB database.

Not available when the Generate JSON Document check box is selected in Advanced settings.

 

Die on error

This check box is cleared by default, meaning to skip the row on error and to complete the process for error-free rows.

Advanced settings

Generate JSON Document

Select this check box for JSON configuration:

Configure JSON Tree: click the [...] button to open the interface for JSON tree configuration. For more information, see Configuring a JSON Tree.

Group by: click the [+] button to add lines and choose the input columns for grouping the records.

Remove root node: select this check box to remove the root node.

Data node and Query node (available for update and upsert actions): type in the name of data node and query node configured on the JSON tree.

Warning

These nodes are mandatory for update and upsert actions. They are intended to enable the update and upsert actions though will not be stored in the database.

tStatCatcher Statistics

Select this check box to collect the log data at the component level.

Global Variables

NB_LINE: the number of rows read by an input component or transferred to an output component. This is an After variable and it returns an integer.

ERROR_MESSAGE: the error message generated by the component when an error occurs. This is an After variable and it returns a string. This variable functions only if the Die on error check box is cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl + Space to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio User Guide.

Usage

tMongoDBOutput executes the action defined on the collection in the MongoDB database based on the flow incoming from the preceding component in the Job.

Log4j

If you are using a subscription-based version of the Studio, the activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User Guide.

For more information on the log4j logging levels, see the Apache documentation at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html.

Limitation

Note

  • The "multi" parameter, which allows to update multiple documents at a time, is not supported. Therefore, if two documents have the same key, the first is always updated, but the second never will.

  • For the update operation, the key cannot be a JSON array.