Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

MongoDb Output - How to Write Array fields/values in a collection?

Hello,
I have a need to write string arrays into a mongodb collection and I am using Talend Big Data and the components that come with that.
However, I do not see any option to define the output field as an array. Is writing to array possible?
Example:
This is the key/value format I need in my collection.
search_key:
Labels (2)
4 Replies
Anonymous
Not applicable
Author

Hi,
I think you need a tjavaflex component in your job design.
See the related forum https://community.talend.com/t5/Design-and-Development/resolved-creating-and-using-Arraylists-in-Tal...
Best regards
Sabrina
Anonymous
Not applicable
Author

Thank you. This is good insight. However, I am getting the value of NULL now.
Here is what I am doing:
tMongodbConnection -->
SQLInput --> tjavaflex --> tmap --> tMongoOutput
tjavaflex:
Start:
// start part of your Java code
java.util.ArrayList list1 = new java.util.ArrayList();

Main:
list1.add("hello");
list1.add("there");
list1.add("test");
globalMap.put("latlong", list1);
-------------------
Then in tmap, I on right side, I have:
column: latlongtest, type: list, Expression: (java.util.ArrayList)globalMap.get("latlong")

I also tried entering (java.util.ArrayList)globalMap.get("latlong") in the Variable section but still getting NULL in mongodb.
latlongtest is defined as list in mongodb schema.
Please help as my project is due on Monday.
Thanks.
Anonymous
Not applicable
Author

Hi,
To make a testing for that, you can use a tlogrow instead of tMongoOutput in your work flow to see if there any data can be out put on console?
Best regards
Sabrina
Anonymous
Not applicable
Author

I did try tLogRow and it shows null.
Is there any documentation of Array/List and globalMap.put?