# tCosmosDBRow

Executes the commands of the Cosmos database.

This component is not shipped with your Talend Studio by default. You need to install it using the Feature Manager. For more information, see [Installing features using the Feature Manager](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/install-features-to-talend-studio).

## tCosmosDBRow Standard properties

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

The Standard tCosmosDBRow component belongs to the Cloud and the Databases families.

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

## Basic settings

| Properties | Description |
| --- | --- |
| Use existing connection | Select this check box and in the Component<br>List drop-down list, select the desired connection component to<br>reuse the connection details you already defined. |
| API | Select the database API to be used. Then the corresponding parameters to be defined are displayed in the Component view.<br><br>In the current version of this component, only the MongoDB API is supported. For this reason, MongoDB database is often mentioned in the documentation of the CosmosDB components. |
| Use replica set address or multiple query routers | Select this check box to show the Server<br>addresses table.<br><br>In the Server addresses<br>table, define the shared MongoDB databases or the MongoDB replica sets<br>you want to connect to. |
| Server and Port | Enter the IP address and listening port of the database<br>server.<br><br>Available when the Use replica set<br>address or multiple query routers check box is not<br>selected. |
| Database | Enter the name of the MongoDB database to be connected to. |
| Authentication mechanism | Among the mechanisms listed on the Authentication mechanism<br>drop-down list, the NEGOTIATE one is recommended if<br>you are not using Kerberos, because it automatically select the authentication mechanism<br>the most adapted to the MongoDB version you are using.<br><br>For details about the other mechanisms in this list, see [MongoDB Authentication](https://docs.mongodb.org/manual/reference/parameters/#param.authenticationMechanisms) from the MongoDB<br>documentation. |
| Set Authentication database | If the username to be used to connect to MongoDB has been created in a specific<br>Authentication database of MongoDB, select this check box to enter the name of this<br>Authentication database in the Authentication database<br>field that is displayed.<br><br>For further information about the MongoDB Authentication database, see [User Authentication database](https://docs.mongodb.org/manual/core/security-users/#user-authentication-database). |
| Username and Password | DB user authentication data.<br><br>To enter the password, click the [...] button<br>next to the password field, enter the password in double quotes in the pop-up dialog box,<br>and click OK to save the settings.<br><br>Available when the Use authentication check box is selected.<br><br>If the security system you have selected from the Authentication mechanism dropdown list is Kerberos, you need to<br>enter the User principal, the Realm and the KDC<br>server fields instead of the Username and the Password<br>fields. |
| Schema and Edit<br>Schema | A schema is a row description. It defines the number of fields<br>(columns) to be processed and passed on to the next component. When you create a Spark<br>Job, avoid the reserved word line when naming the<br>fields.<br><br>Click Edit<br>schema to make changes to the schema. If the current schema is of the Repository type, three options are available:<br><br><ul> <li> <p> <span>View schema</span>: choose this                option to view the schema only.</p> </li> <li> <p> <span>Change to built-in property</span>:                choose this option to change the schema to <span>Built-in</span> for local changes.</p> </li> <li> <p> <span>Update repository connection</span>:                choose this option to change the schema stored in the repository and decide whether                to propagate the changes to all the Jobs upon completion.</p> <p>If you just want to                propagate the changes to the current Job, you can select <span>No</span> upon completion and choose this schema metadata                again in the <span>Repository Content</span>                window.</p> </li> </ul><br><br>Click Sync<br>columns to retrieve the schema from the previous component connected in the<br>Job. |
| Execute command | Select this check box to enter MongoDB commands in the Command field for execution.<br><br><ul> <li> <p> <span>Command</span>: in this field,										enter the command to be executed, if this command contains										one single variable.</p> <div>For example, if you need to construct the										command<pre><code><pre><code><code>{"isMaster": 1}</code></code></pre></code></pre>You										need simply enter <kbd>isMaster</kbd> within quotation marks.</div> </li> <li> <p> <span>Construct command from keys and											values</span>: if the command to be executed										contains multiple variables, select this check box and in										the <span>Command keys and values</span>										table, add the variables and their respective values to be										used.</p> <div>For example, if you need to construct the following										command										<pre><code><pre><code><code>{ renameCollection : "&lt;source_namespace&gt;" , to : "&lt;target_namespace&gt;" , dropTarget : &lt; true \| false &gt; }</code></code></pre></code></pre>You										need to add three rows to the <span>Command											keys and values</span> table and enter one										variable-value pair to each row within quotation										marks:<pre><code><pre><code><code>"renameCollection"      "old_name""to"                    "new_name""dropTarget"            "false"</code></code></pre></code></pre> </div> </li> <li> <p> <span>Construct command from a JSON											string</span>: if you want to directly enter the										command to be used, select this check box and enter this										command in the <span>JSON string											command</span> field that is displayed. Only one										command is allowed per <span>tCosmosDBRow</span>.</p> <div>For										example:<pre><code><pre><code><code>"{createIndexes: 'restaurants', indexes : [{key : {restaurant_id: 1}, name: 'id_index_2', unique: true}]}"</code></code></pre></code></pre> </div> <p>Note that you must use single quotation marks to surround										the string values used in the command and double quotation										marks to surround the command itself.</p> <p>For further information about the MongoDB commands you can										use in this field, see <a href="https://docs.mongodb.org/manual/reference/command/" target="_blank">https://docs.mongodb.org/manual/reference/command/</a>.</p> </li> </ul> |
| Die on error | This check box is cleared by default, meaning to skip the row on error<br>and to complete the process for error-free rows. |

## Advanced settings

| Properties | Description |
| --- | --- |
| tStatCatcher Statistics | Select this check box to collect the log data at the component<br>level. |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | tCosmosDBRow allows you to manipulate<br>the Cosmos database through the MongoDB commands. |