Talend Tutorials

Mongodb Json Part Two

Mongodb Json Part Two

| Matt Irvin

Continued from Part 1

Part 2: MongoDB → JSON

Step 1: Create a new job

Create a separate job from Part 1.

We will begin by placing a tMongoDBInput component and connecting it to a tLogRow component.

image 1

In this job, we are only going to pull one of the three JSON items we loaded into the database. In this case, the one containing make:Toyota.

To do this, we will need to make sure we connect to the right Database, we used “Demos” last time, as well as the correct Collection “Cars”. Then, we need to make sure our output schema is correct so click the “Edit schema” button and make sure there is a column for each field.

image 2

Then make sure the Query is set to “{make : ‘Toyota’}”

The mapping should be auto-populated.

image 3

Step 2: Check your output.

If you haven’t already, add a tLogRow component to view the output and make sure it is correct.

Run the job to view the output.

image 4

Step 3: Convert to JSON file

Lastly, place a FileOutputJSON component at the end of the run sequence.

image 5

Set your path and name of the data block and sync columns.

image 6

Step 4: Run final job and view output

image 7

Looking For More Talend Help?
Contact Us Today