# tMongoDBLookupInput (deprecated)

Availability-note[Deprecated](https://help.talend.com/r/en-US/Cloud/labels-on-talend-help-center/availability-deprecated)

This content is deprecated.

Executes a database query with a strictly defined order which must correspond to the schema definition.

Information noteDeprecation: Spark Streaming is deprecated beginning with the R2026-09 release. Use Spark Structured Streaming instead.

It passes on the extracted data to tMap in order to provide the lookup data to the main flow. It must be directly connected to a tMap component and requires this tMap to use Reload at each row or Reload at each row (cache) for the lookup flow.

## tMongoDBLookupInput properties for Apache Spark Streaming

These properties are used to configure tMongoDBLookupInput running in the Spark Streaming Job framework.

The Spark Streaming tMongoDBLookupInput component belongs to the Databases family.

The component in this framework is available in Talend Real-Time Big Data Platform and in Talend Data Fabric.

## Basic settings

| Properties | Description |
| --- | --- |
| Property type | Either Built-In or Repository.<br><br><br>Built-In: No property data stored centrally.<br><br><br>Repository: Select the repository file where the<br>properties are stored. |
| MongoDB configuration | 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. |
| 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>If a column in the database is a JSON document and you need to read<br>the entire document, put an asterisk (\*) in the DB<br>column column, without quotation marks around. |
| Collection | Enter the name of the collection to be used.<br><br>A MongoDB collection is the equivalent of an RDBMS table and contains<br>documents. |
| Set read preference | Select this check box and from the Read preference<br>drop-down list that is displayed, select the member to which you need to direct the read<br>operations.<br><br>If you leave this check box clear, the Job uses the default Read preference, that is to<br>say, uses the primary member in a replica set.<br><br>For further information, see MongoDB's documentation about Replication and its Read<br>preferences. |
| Query | Specify the query statement to select documents from the collection specified in the<br>Collection field.<br><br>For<br>example<br><br>```<br>"{'customer_id':" + row1.customer_id +"}"<br>```<br><br>In this code, *row1* is not the label of the link to<br>tMongoDBLookupInput, but represents the main row<br>entering into tMap.<br><br>The result of the query must contain only records that match join key you need to use in<br>tMap. In other words, you must use the schema of the<br>main flow to tMap to construct the SQL statement here in<br>order to load only the matched records into the lookup flow.<br><br>This approach ensures that no redundant records are loaded into memory and outputted to<br>the component that follows. |
| Mapping | Each column of the schema defined for this component represents a field of the documents<br>to be read. In this table, you need to specify the parent nodes of these fields, if<br>any.<br><br>For example, in the document reading as<br>follows<br><br>```<br>{<br>_id: ObjectId("5099803df3f4948bd2f98391"),<br>person: { first: "Joe", last: "Walker" }<br>}<br>```<br><br><br>The<br>*first* and the *last*<br>fields have *person* as their parent node but the *\_id* field does not have any parent node. So once completed, this<br>Mapping table should read as<br>follows:<br><br>```<br>Column     Parent node path<br>_id<br>first       "person"<br>last        "person"<br>``` |
| Limit | Enter the maximum number of records to be retrieved. |

## Advanced settings

| Properties | Description |
| --- | --- |
| No query timeout | Select this check box to prevent MongoDB servers from stopping idle<br>cursors at the end of 10-minute inactivity of these cursors. In this<br>situation, an idle cursor will stay open until either the results of<br>this cursor are exhausted or you manually close it using the<br>cursor.close() method.<br><br>A cursor for MongoDB is a pointer to the result set of a query. By<br>default, that is to say, with this check box being clear, a MongoDB<br>server automatically stops idle cursors after a given inactivity period<br>to avoid excess memory use. For further information about MongoDB<br>cursors, see https://docs.mongodb.org/manual/core/cursors/. |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | This component is used as a start component and requires an output link.<br><br>This component should use a tMongoDBConfiguration component present in the same Job to connect<br>to a MongoDB database. You need to drop a tMongoDBConfiguration component alongside this component and<br>configure the Basic settings of this component<br>to use tMongoDBConfiguration.<br><br>This component, along with the Spark Streaming component Palette it belongs to, appears<br>only when you are creating a Spark Streaming Job.<br><br>Note that in this documentation, unless otherwise explicitly stated, a scenario presents<br>only Standard Jobs, that is to say traditional<br>Talend<br>data<br>integration Jobs. |
| Spark Connection | In the Spark<br>Configuration tab in the Run<br>view, define the connection to a given Spark cluster for the whole Job. In<br>addition, since the Job expects its dependent jar files for execution, you must<br>specify the directory in the file system to which these jar files are<br>transferred so that Spark can access these files:<br><br><ul> <li> <div> <span>Yarn mode</span> (Yarn client or Yarn cluster):<ul> <li> <p>When using Google Dataproc, specify a bucket in the                                            <span>Google Storage staging bucket</span>                                        field in the <span>Spark configuration</span>                                        tab.</p> </li> <li> <p>When using HDInsight, specify the blob to be used for Job                                        deployment in the <span>Windows Azure Storage                                            configuration</span> area in the <span>Spark                                            configuration</span> tab.</p> </li> <li>When using Altus, specify the S3 bucket or the Azure                                    Data Lake Storage for Job deployment in the <span>Spark                                        configuration</span> tab.</li> <li> <p>When using on-premises distributions, use                                        the configuration component corresponding to the file system                                        your cluster is using. Typically, this system is HDFS and so                                        use <a href="https://help.qlik.com/talend/r/en-US/8.0/components/hdfs/thdfsconfiguration">tHDFSConfiguration</a>.</p> </li> </ul> </div> </li> <li> <p> <span>Standalone mode</span>: use the                            configuration component corresponding to the file system your cluster is                            using, such as <a href="https://help.qlik.com/talend/r/en-US/8.0/components/hdfs/thdfsconfiguration-properties-for-apache-spark-batch">tHDFSConfiguration Apache Spark Batch</a> or <a href="https://help.qlik.com/talend/r/en-US/8.0/components/amazon-s3/ts3configuration-properties-for-apache-spark-batch">tS3Configuration Apache Spark Batch</a>.</p> <p>If you are using Databricks without any configuration component present                            in your Job, your business data is written directly in DBFS (Databricks                            Filesystem).</p> </li> </ul><br><br>This connection is effective on a per-Job basis. |

**Related concepts**

* [Reading and writing data in MongoDB using a Spark Streaming Job](https://help.qlik.com/talend/en-US/components/8.0/mongodb/tmongodblookupinput-tmongodbconfiguration-ts3configuration-reading-and-writing-data-in-mongodb-using-spark-streaming-job-spark-stream-component-in-this)