tMongoDBOutput Standard properties - Cloud - 8.0

MongoDB

Version
Cloud
8.0
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Data Governance > Third-party systems > NoSQL components > MongoDB components
Data Quality and Preparation > Third-party systems > NoSQL components > MongoDB components
Design and Development > Third-party systems > NoSQL components > MongoDB components
Last publication date
2024-02-20

These properties are used to configure tMongoDBOutput running in the Standard Job framework.

The Standard tMongoDBOutput component belongs to the Big Data and the Databases NoSQL families.

The component in this framework is available in all Talend products with Big Data and in Talend Data Fabric.

Basic settings

Use existing connection

Select this check box and in the Component List drop-down list, select the desired connection component to reuse the connection details you already defined.

DB Version

Select the database version you want to use from the drop-down list

This field is available when the Use existing connection check box is not selected.

Use connection string

Select this option to establish a connection using a MongoDB Atlas URI. Enter the URI in the field to the right. See Connection String URI Format for related information.

This option is available when you select MongoDB 4.4.X and later from the DB Version drop-down list.

Note: This option is available only when you have installed the R2021-12 Talend Studio Monthly update or a later one delivered by Talend. For more information, check with your administrator.

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

Enter the IP address and listening port of the database server.

These fields are available when the Use existing connection or Use replica set address check box are not selected.

Database

Enter the name of the database.

Use SSL connection (Configure the SSL authentication in tSetKeystore or in Studio preferences)

Select this check box to enable the SSL or TLS encrypted connection.

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

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

Set write concern

Select this check box to set the level of acknowledgement requested for write operations. 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 Talend Studio.
  • If you select Ordered, MongoDB processes the queries sequentially.

  • If you select Unordered, MongoDB optimizes the bulk write operations without keeping the order in which the individual operations were inserted in the bulk write.

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.

Among the mechanisms listed on the Authentication mechanism drop-down list, the NEGOTIATE one is recommended if you are not using Kerberos, because it automatically select the authentication mechanism the most adapted to the MongoDB version you are using.

Because the SCRAM-SHA-256 authentication mechanism is only supported by MongoDB 4.x and later versions, SCRAM-SHA-256 SASL option is available only when MongoDB 4.4.X and later is selected from the DB Version drop-down list.

Note: The X509 option is available only when you have installed the R2021-12 Talend Studio Monthly update or a later one delivered by Talend. For more information, check with your administrator.

For details about the other mechanisms in this list, see MongoDB Authentication from the MongoDB documentation.

Set Authentication database

If the username to be used to connect to MongoDB has been created in a specific Authentication database of MongoDB, select this check box to enter the name of this Authentication database in the Authentication database field that is displayed.

For further information about the MongoDB Authentication database, see User Authentication database.

Username and Password

Enter the database user authentication data.

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

This field is 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

Enter the 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 documents.

  • Set: modifies the existing fields of an existing document and appends a field if it does not exist in this document.

    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: replaces the existing documents with the incoming data but keeps the technical ID of these documents.

  • Upsert: inserts a document if it does not exist otherwise it applies the same rules as Update.

  • Upsert with set: inserts a document if it does not exist otherwise it applies the same rules as Set

    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 documents.

    If you need to apply this action on all the documents in the collection to be used, selected the Delete all documents check box that is displayed, otherwise, only one documented is deleted.

Schema

A schema is a row description. It defines the number of fields (columns) to be processed and passed on to the next component. When you create a Spark Job, avoid the reserved word line when naming the fields.

  • Built-In: You create and store the schema locally for this component only.

  • Repository: You have already created the schema and stored it in the Repository. You can reuse it in various projects and Job designs.

Edit Schema

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.

This component supports dynamic schema when inserting documents to a collection. To use the dynamic schema feature, make sure the schema contains only one column, with the DB column set to * and Type set to String (if the input type is String) or Object (if the input type is Object).

Note:
  • The dynamic schema feature is available only when Insert is selected from the Action on data drop-down list.
  • The dynamic schema feature is available only when you have installed the 8.0.1-R2022-07 Talend Studio Monthly update or a later one delivered by Talend. For more information, check with your administrator.

Mapping

Each column of the schema defined for this component represents a field of the documents to be read. In this table, you need to specify the parent nodes of these fields, if any.

For example, in the document reading as follows
{
               _id: ObjectId("5099803df3f4948bd2f98391"),
               person: { first: "Joe", last: "Walker" }
            }
The first and the last fields have person as their parent node but the _id field does not have any parent node. So once completed, this Mapping table should read as follows:
Column     Parent node path
_id
first       "person"
last        "person"

Updatable and Insertable: As the name applies, specify whether or not a field can be updated and inserted. These two columns appear when Upsert with set is selected from the Action on data drop-down list.

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.
Note: You can adapt the JSON objects into BSON objects by adding __DOLLAR__ before the object (for example, $oid and $date become respectively __DOLLAR__oid and __DOLLAR__date). The MongoDB specific objects can then be read and not considered as character string.

Create empty element if needed: If the Related Column in the XML tree editor has null values, or if no column is associated with the XML node, this option creates an open/close tag in the expected place. This check box is selected by default.

Ignore service attributes for empty elements: Select this option to prevent the component from generating a node if the input node is null but has service attributes (such as @type, @class, and @array). This option is available when the Create empty element if needed option is not selected.

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.

Node (available for Set and Upsert with set actions): specify the update operations for specific JSON nodes. To add an update operation, click the plus button at the bottom of this field, enter the update operator or select the update operator from the drop-down list in the Node type column, and enter the node name in double quotation marks in the Node reference column. See Update Operators for information about update operators.
Note: This field is available only when you have installed the R2022-01 Talend Studio Monthly update or a later one delivered by Talend. For more information, check with your administrator.

No query timeout

Select this check box to prevent MongoDB servers from stopping idle cursors at the end of 10-minute inactivity of these cursors. In this situation, an idle cursor will stay open until either the results of this cursor are exhausted or you manually close it using the cursor.close() method.

A cursor for MongoDB is a pointer to the result set of a query. By default, that is to say, with this check box being clear, a MongoDB server automatically stops idle cursors after a given inactivity period to avoid excess memory use. For further information about MongoDB cursors, see https://docs.mongodb.org/manual/core/cursors/.

tStatCatcher Statistics

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

Global Variables

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 more information about variables, see Using contexts and variables.

Usage

Usage rule

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

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.