Warning
This component will be available in the Palette of
Talend Studio on the condition that you have subscribed to one of
the Talend
solutions with Big Data.
Component family |
Big Data / MongoDB |
|
Function |
tMongoDBRow executes the commands |
|
Purpose |
This component allows you to execute the commands and functions of |
|
Basic settings |
Use existing connection |
Select this check box and in the Component List click the |
|
DB Version |
List of the database versions. Available when the Use existing |
|
Use replica set address |
Select this check box to show the Replica In the Replica address table, you Available when the Use existing |
|
Server and Port |
Address and listening port of the database server. Available when the Use existing |
|
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 For further information about tSetKeystore, see tSetKeystore. Note that the SSL connection is available only for the version 2.4 + of MongoDB. |
|
|
Required authentication |
Select this check box to enable the database |
|
Username and Password |
DB user authentication data. To enter the password, click the […] button next to the Available when the Required |
Schema and Edit |
A schema is a row description. It defines the number of fields to be processed and passed on Click Edit schema to make changes to the schema. If the
Click Sync columns to retrieve the schema from the |
|
|
Execute command |
Select this check box to enter MongoDB commands in the Command field for execution. |
|
Function |
Enter MongoDB functions in the Function field for execution. Not available when the Execute |
|
Parameters value |
Click the [+] button to add lines Not available when the Execute |
Die on error |
This check box is cleared by default, meaning to skip the row on |
|
Advanced settings |
tStatCatcher Statistics |
Select this check box to collect the log data at the component |
Global Variables |
ERROR_MESSAGE: the error message generated by the A Flow variable functions during the execution of a component while an After variable To fill up a field or expression with a variable, press Ctrl + For further information about variables, see Talend Studio |
|
Usage |
tMongoDBRow allows you to |
|
Log4j |
The activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User 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 |
n/a |
This scenario creates the collection blog and writes post
data to it through the MongoDB functions.
-
Drop tMongoDBConnection, tFixedFlowInput, tMongoDBRow, tMongoDBClose,
tMongoDBInput and tLogRow onto the workspace. -
Rename tFixedFlowInput as blog_post_data, tMongoDBRow as write_data_to_collection, tMongoDBInput as read_data_from_collection and tLogRow as show_data_from_collection.
-
Link tMongoDBConnection to tFixedFlowInput using the OnSubjobOk trigger.
-
Link tFixedFlowInput to tMongoDBRow using a Row > Main
connection. -
Link tFixedFlowInput to tMongoDBInput using the OnSubjobOk trigger.
-
Link tMongoDBInput to tMongoDBClose using the OnSubjobOk trigger.
-
Link tMongoDBInput to tLogRow using a Row > Main
connection.
-
Double-click tMongoDBConnection to open
its Basic settings view. -
From the DB Version list, select the
MongoDB version you are using. -
In the Server and Port fields, enter the connection details.
In the Database field, enter the name of the MongoDB
database. -
Double-click tFixedFlowInput to open its
Basic settings view.Select Use Inline Content (delimited
file) in the Mode
area.In the Content field, enter the data to write to the
MongoDB database, for example:123Andy;Open Source Outlook;Open Source,Talend;Talend, the leader of the open source world...Andy;Data Integration Overview;Data Integration,Talend;Talend, the leading player in the DI field...Andy;ELT Overview;ELT,Talend;Talend, the big name in the ELT circle... -
Double-click tMongoDBRow to open its
Basic settings view.Select the Use existing connection check
box.In the Function field, enter the MongoDB function to
create the collection blog and insert
data to it:123456"function(author,title,keywords,contents){return db.blog.save({author:author,title:title,keywords:keywords,contents:contents});}" -
Click the […] button next to Edit schema to open the schema editor.
-
Click the [+] button to add four columns
in the right part, namely author,
title, keywords and contents,
with the type of String.Click to copy all the columns to the input table.
Click OK to close the editor.
-
In the Parameters value table, click the
[+] button to add four lines and enter
the values in sequence: row1.author,
row1.title, row1.keywords and row1.contents. By doing so, data of row1 will be transferred to the parameters defined in the
function. -
Double-click tMongoDBInput to open its
Basic settings view.Select the Use existing connection check
box.In the Collection field, enter the name
of the collection, namely blog. -
Click the […] button next to Edit schema to open the schema editor.
-
Click the [+] button to add four columns,
namely author, title, keywords and
contents, with the type as String.Click OK to close the editor.
-
Double-click tLogRow to open its
Basic settings view.In the Mode area, select Table (print values in cells of a table for
better display.