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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Selecting data from MongoDB

All,
I'm creating a job which will be extracting data from mongodb daily, mapping json doc to flat table and inserting that into mysql.
Problem: I have to pass start and end date ( taken from globalMap.get("start") and globalMap.get("end") ) dates to mongodb query. What component can I use to do that ? The problem with tmongodbRow component is it allows parameters , and let say i can create a javascript function with find query in it , but output document has to be mapped to a flat resultset. Unfortunately only tmongodbinput has this mapping ability. i can take fields from sub document and map them to a flat structure. BUT tmongodbinput does not allow parameters to be passed to a query.
I'm sure someone has faced this issue, i would really appreciate your response.
The solution ( sub optimal ) I've came up with is first use tmongodbrow and execute javascript function which extracts data and inserts it into a temporary mongodb collection, then next component tmongodbinput extracts all data and maps it into flat table. The problem with this approach is that db.insert(... ) in mongodb locks the database..... I would like to just run select from mongodb with "where" and avoid inserts.
Labels (4)
11 Replies
krengan21
Creator
Creator

hi,
I am trying to get the data of the previous date but i am getting the error in tmongodbinput component.What needs to be done to load only the previous day date using talend.
raowaqasakram
Contributor III
Contributor III

I have created a context variable .

 

Data type is String

 

String last_sync_timestamp= "2022-08-16T00:00:00.533Z" ;

 

Query :

 

{'timestamp': {$gt: {$date: '"+context.last_sync_timestamp+"'}

 

This worked absolutely fine for me in TOS 8.0.