# tCouchbaseInput

Queries the documents from the Couchbase database.

## tCouchbaseInput Standard properties

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

The Standard tCouchbaseInput component belongs to the Databases NoSQL family.

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

## Basic settings

| Properties | Description |
| --- | --- |
| Bootstrap nodes | Enter the name or IP of the node to be bootstrapped by Couchbase SDK. As Couchbase recommends to specify multiple nodes to bootstrap, enter the names or IPs of these nodes in this field, separating them using commas (,).<br><br>For further information about Couchbase bootstrapping, see [How Couchbase SDKs connect to the cluster](https://developer.couchbase.com/documentation/server/4.1/developer-guide/connection-advanced.html).<br><br>You can find the node names on the Servers page in your Couchbase Web Console. If you need further information, contact the administrator of your Couchbase cluster or consult your Couchbase documentation.<br><br>Note that the Couchbase servers do not support proxies; for this reason, the<br>Couchbase components from Talend do not<br>support proxies either. |
| Username and Password | Provide the authentication credentials to your Couchbase cluster.<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>If you are using Couchbase V5.0 and onwards, enter the same value<br>you put in the Bucket field as<br>password, because since Couchbase V5.0, no password is associated with a<br>bucket. However, on Couchbase, you need to create a user with appropriate<br>role to access the buckets.<br><br>For further information about the access control and other<br>important requirements on the Couchbase side, see Couchbase release note of<br>your version.<br><br>To enter the password, click the [...] button<br>next to the Password field to bring out the Enter a new<br>password dialog box, enter the password in the text field, and click<br>OK. Note that you can enter the password either in a JSON string<br>in the pure password mode or as a Java expression in the Java<br>mode. You can toggle between the two modes by clicking switch to<br>Java mode or switch to pure password mode on the top<br>of the text field.<br><br>Information noteNote:<br><br><ul> <li>The two password modes are available only when you have installed the                  8.0.1-R2022-05 <span>Talend Studio</span>                  monthly update or a later one delivered by <span>Talend</span>. For more information, check with your administrator.</li> <li>If the 8.0.1-R2022-05 <span>Talend Studio</span>                  monthly update or a later one delivered by <span>Talend</span>                  is not installed, you can enter passwords in the <span>Java mode</span>                  only. </li> </ul> |
| 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>When using non-JSON documents, define an<br>id column of the String<br>type, then define a content column. The type of this<br>content column should be<br>String for the string documents and<br>byte[] for the binary documents.<br><br>When it comes to JSON documents, define the fields that exist<br>in your JSON documents. |
| Bucket | Enter, within double quotation marks, the name of the data bucket in the<br>Couchbase database.<br><br>Ensure that the credentials you are using have the appropriate rights and<br>permissions to access this bucket.<br><br>If you are using Couchbase V5.0 and onwards, this bucket name is the user name you have created in the Security tab of your Couchbase UI. |
| Document type | Data stored in a Couchbase database could be JSON, strings or<br>binary. From this drop-down list, select the type of the data you need to<br>use with Couchbase.<br><br>Note that it is not recommended to mix JSON, binary and string documents in a<br>same bucket, as this mixture could make the document processing<br>error-prone.<br><br>If you need to use N1QL to query string or binary documents,<br>the only possible way is to use the document ID to get the document. For<br>example, if you need to get a document for which the ID number is 2, the<br>N1QL query should<br>be<br><br>```<br>SELECT meta().id as `_meta_id_` FROM `bucket_name` where meta().id = '2';<br>```<br><br>Note that the quotations marks around \_meta\_id\_ and<br>bucket\_name are backticks (`). |
| Query Type | Select the type of queries to be used from the following options:<br><br><ul> <li> <span>Select All</span>: select all the contents of a given                           bucket.</li> <li> <span>N1QL</span>: use an N1QL statement to perform fine-tuned                           queries.</li> <li> <span>N1QL for Analytics</span>: use an N1QL for Analytics                           statement to perform queries. N1QL for Analytics is a language for                           querying semistructured data. </li> <li> <span>Document ID</span>: use the document IDs to select                           documents. You need to enter the ID to be used in the<span>Document                              ID</span> field that is displayed. Only one document ID is                           allowed per component.</li> </ul><br><br>Information noteNote:<br><br><ul> <li>See <a href="https://docs.couchbase.com/server/current/analytics/1_intro.html" target="_blank">N1QL for Analytics Language Reference</a> for information about N1QL for Analytics.</li> <li>See <a href="https://docs.couchbase.com/server/current/analytics/6_n1ql.html" target="_blank">N1QL for Analytics vs. N1QL for Query</a> for a comparison between <span>N1QL for Analytics</span> and <span>N1QL for Query</span>.</li> </ul> |
| Query | Enter an N1QL query statement or an N1QL for<br>Analytics statement to perform complex actions.<br><br>Only one statement is allowed. Do not put quotation marks around the<br>statement.<br><br><ul> <li> <p>When you use wildcards in your query such as <span>SELECT *</span>, the returned result of this query is wrapped                  in the bucket name used in this query. In this situation, define only one column                  for the result in the schema of this component.</p> <div>For example, when performing this query                  <pre><code><pre><code><code>SELECT * FROM `travel_sample` limit 3</code></code></pre></code></pre>The                  returned result is wrapped in the <kbd>travel_sample</kbd> bucket, reading like this:                  <pre><code><pre><code><code>[  {    "travel_sample": {      "callsign": "MILE-AIR",      "country": "United States",      "iata": "Q5",      "icao": "MLA",      "id": 10,      "name": "40-Mile Air",      "type": "airline"    }  },  {    "travel_sample": {      "callsign": "TXW",      "country": "United States",      "iata": "TQ",      "icao": "TXW",      "id": 10123,      "name": "Texas Wings",      "type": "airline"    }  },  {    "travel_sample": {      "callsign": "atifly",      "country": "United States",      "iata": "A1",      "icao": "A1F",      "id": 10226,      "name": "Atifly",      "type": "airline"    }  }]</code></code></pre></code></pre> </div> <p>In the schema, define one single column called, for example,                    <kbd>travel_sample</kbd> to store the result and                  select <span>String</span> as its type.</p> </li> <li> <div>If you use a query without wildcards, such as                  <pre><code><pre><code><code>SELECT callsign, country, iata, icao, id, name, type FROM `travel_sample` limit 3;</code></code></pre></code></pre>The                  returned result is not wrapped, reading like this:                  <pre><code><pre><code><code>[  {    "callsign": "MILE-AIR",    "country": "United States",    "iata": "Q5",    "icao": "MLA",    "id": 10,    "name": "40-Mile Air",    "type": "airline"  },  {    "callsign": "TXW",    "country": "United States",    "iata": "TQ",    "icao": "TXW",    "id": 10123,    "name": "Texas Wings",    "type": "airline"  },  {    "callsign": "atifly",    "country": "United States",    "iata": "A1",    "icao": "A1F",    "id": 10226,    "name": "Atifly",    "type": "airline"  }]</code></code></pre></code></pre> </div> <p>In this situation, define the columns that represent the                  structure of the actual business data, such as the following columns, in the                  component schema: <kbd>callsign</kbd>, <kbd>country</kbd>, <kbd>iata</kbd>, <kbd>icao</kbd>, <kbd>id</kbd>, <kbd>name</kbd> and                    <kbd>airline</kbd>. </p> </li> </ul><br><br>Information noteNote: This field is available when you select N1QL or N1QL<br>Analytics from the Query type drop-down<br>list. |

## Advanced settings

| Properties | Description |
| --- | --- |
| tStatCatcher Statistics | Select this check box to collect log data at the component<br>level. |
| Use custom connection parameters | Select this option to set connection parameters, including Connection<br>timeout, Query timeout,<br>Analytics timeout, and Query<br>threshold.<br><br>To set a connection parameter, add a row in the Connection parameters<br>table by clicking the plus button on the bottom of the table, click the<br>Parameter name column and select the desired<br>parameter from the drop-down list, and then enter the parameter value in the<br>Parameter value column. |
| Use TLS | Select this option to enable TLS for securing data transferred. See [Couchbase TLS](https://docs.couchbase.com/operator/current/concept-tls.html) for related information.<br><br>Information noteNote: This option is available only when you have installed the 8.0.1-R2022-06<br>Talend Studio Monthly update or a later one delivered by Talend. For more information, check with your administrator. |
| Java Truststore | Enter the truststore file name. See [KeyStores and TrustStores](https://docs.oracle.com/cd/E19509-01/820-3503/ggffo/index.html) for related information.<br><br>Information noteNote: This option is available only when you select the Use<br>TLS option. |
| Java Truststore password | Enter the password for the truststore file. See [Generating a KeyStore and TrustStore](https://docs.oracle.com/cd/E19509-01/820-3503/6nf1il6er/index.html) for related information.<br><br>Information noteNote: This option is available only when you select the Use<br>TLS option. |
| Java Truststore type | Enter the Java truststore type, which defaults to JKS.<br><br>Information noteNote: This option is available only when you select the Use<br>TLS option. |
| Limit rows | Enter the maximum number of rows to be read. This field is not available when you use a N1QL query. |
| Create primary index | Select this check box to let the component create a primary index of your<br>database, or create a new primary index if one already exists.<br><br>By default, this<br>check box is cleared, as the creation of primary index can be optional if<br>secondary index exists.<br><br>For more information about primary index, see<br>[Create primary index](https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/createprimaryindex.html) from the official<br>Couchbase documentation. |

## Global Variables

| Variables | Description |
| --- | --- |
| Global Variables | NB\_LINE: the number<br>of rows read by an input component or transferred to an output component. This is an<br>After variable and it returns an integer.<br><br><br>ERROR\_MESSAGE: the error message generated by the<br>component when an error occurs. This is an After variable and it returns a string. This<br>variable functions only if the Die on error checkbox is<br>cleared, if the component has this checkbox.<br><br>A Flow variable functions during the execution of a component<br>while an After variable functions after the execution of the component.<br><br>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<br>it.<br><br>For more information about variables, see [Using contexts and variables](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/contexts-and-variables). |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | As a start component, tCouchbaseInput reads the documents from the Couchbase database. |

**Related concepts**

* [Querying JSON documents from a Couchbase database with a N1QL query](https://help.qlik.com/talend/en-US/components/8.0/couchbase/tcouchbaseinput-tlogrow-querying-json-documents-from-couchbase-database-with-n1ql-query "In this scenario, you query JSON documents with a N1QL query. It uses the travel-sample sample bucket data provided by Couchbase. Specifically, it retrieves the 5 first airlines located in the United States from the sample data.")