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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] tRESTClient to Mongo

Hi everyone,
Please forgive me if I skipped something easy I'm new with Talend. 
I want to do something that sounds simple to me. I get JSON array by a RESTful API, and I want to insert all the datas in a mongo collection.
I've got already the plugins for mongo.
Thx !
Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Okay so I finally found the error. The connection to mongo wasn't established yet.
In the other cases, it works because (I think) I placed a mongoInput before the table and in this case not
Really sorry, sh***y mistake .....
Thx for your time and implication by the way

View solution in original post

8 Replies
Anonymous
Not applicable
Author

Hi,
Have you already checked component  TalendHelpCenter:tMongoDBOutput which i nserts, updates, upserts or deletes documents in a MongoDB database collection based on the incoming flow from the preceding component in the Job.

Best regards
Sabrina
Anonymous
Not applicable
Author

hi,
Thx your reply. After some researches, I finally found the issue. 
0683p000009MDFK.jpg
This was the main mistake I made. My job wasn't good at all too. This is what I do and now it works:
0683p000009MDFP.jpg

Everything works fine now. 


But I'm facing another problem with Excel. 
0683p000009M9yY.jpg 
What's wrong ? It works if I replace mongoOutput with something like LogRow.
Edit: Oh and another question, are plugins (mongo) updated on the exchange ? I got a problem with authentication and it should be resolved:
https://jira.talendforge.org/browse/TDI-22062
Thx
Anonymous
Not applicable
Author

Hi,
For your issue(java.lang.NullPointerException), could you please show us the component setting screenshot of tMongoDBoutput? Is DB connection OK with you?
Best regards
Sabrina
Anonymous
Not applicable
Author

Connection to DB should be good, as I did the same config for the other jobs.
But I just can't do the same way with the Excel component. Maybe by putting JSON fields on the way ?
Anonymous
Not applicable
Author

Hi,
Have you tried to use tfileinputjson component to see if it is OK with you?
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi,
Yes, but not fileinput.
I tried this way:
Excel -> Map -> FileOutputJSON
If I put logrow at the end, it works. If I put Mongooutput, fail. And always this error:
Exception in component tMongoDBOutput_1
java.lang.NullPointerException
at test.integration_excel_0_1.integration_excel.tFileInputExcel_1Process(integration_excel.java:814)
at test.integration_excel_0_1.integration_excel.runJobInTOS(integration_excel.java:1757)
at test.integration_excel_0_1.integration_excel.main(integration_excel.java:1614)
Am I missing something ? Excel headers, or chars, or whatever that could be problematic ?

EDIT: the error is at this line:
com.mongodb.DBCollection coll_tMongoDBOutput_1 = db_tMongoDBOutput_1
.getCollection("buddytest");
BUT this is present in the other jobs, and works fine. 
Anonymous
Not applicable
Author

Okay so I finally found the error. The connection to mongo wasn't established yet.
In the other cases, it works because (I think) I placed a mongoInput before the table and in this case not
Really sorry, sh***y mistake .....
Thx for your time and implication by the way
Anonymous
Not applicable
Author

Hi  brian.dechoux,
Okay so I finally found the error. The connection to mongo wasn't established yet.
In the other cases, it works because (I think) I placed a mongoInput before the table and in this case not
.

Thanks for your feedback. Can you use tMongoDBConnection to  open a connection to a database in order that a transaction may be made?

Best regards
Sabrina