One Star

tMongoDBRow or tMongoDBInput can handle Aggregation Framework queries?

Hi,
I was wondering if someone with experience using the tMongoDB components might suggest a fix. Although the components predate some of the functionality on MongoDB I am looking to use, the following 'query' encapsulates an aggregation framework pipeline in a single run.Command, so I'm hoping it gets treated as any other query to MongoDB that these components can handle.
As per screenshot, I am using a tMongoDBInput Query, passing this string:
"db.runCommand({aggregate:'posts',pipeline:});"
Which is failing as per the errors. Am I missing something.
I can see from the online example under tMongoDBRow that passing a function works and there is an "Execute command" in this component ... should I be using this to run this query instead?
Any suggestions much appreciated. Thanks.

5 REPLIES
One Star

Re: tMongoDBRow or tMongoDBInput can handle Aggregation Framework queries?

Hi there, I wrote a blog post with some videos to explain this, hope it helps!
http://techpoet.blogspot.ie/2013/06/new-mongodb-components-in.html
One Star

Re: tMongoDBRow or tMongoDBInput can handle Aggregation Framework queries?

Ernesto,
Thanks for the response. Did you ascertain this by trial and error, or is it documented somewhere, as the Talend docs don't really handle the aggregation framework. Your solution was to assign the aggregation query to a variable and write the variable.results to a separate collection. Is this the only clean way of working with Aggregation Framework using Talend? Have you tried feeding any parameters to a tMongoRow that is running an aggregation query.
I had come across this link:
http://community.jaspersoft.com/wiki/jaspersoft-mongodb-query-language
How does this link back in with Talend proper or is it only applicable to the Jaspersoft 'version' of Talend?
Any links to further documentation on tMongo*** components outside of the official Talend documentation would be much appreciated.
Thanks again,
Colum
One Star

Re: tMongoDBRow or tMongoDBInput can handle Aggregation Framework queries?

Hello,
I work with TmongoDBrow but i can't use more than 24 parameters in my function.
How can i do?
Thank you
One Star

Re: tMongoDBRow or tMongoDBInput can handle Aggregation Framework queries?

Hi,
This is my query to tmongodbinput "{createdDate : { $gte :{\"$date\":\"2014-01-01T00:00:00Z\"}, $lte :{\"$date\":\"2014-01-31T00:00:00Z\"}} }" . I want to replay the values with parameters  (greater than yesterday date and less than today). How do i do that.
One Star

Re: tMongoDBRow or tMongoDBInput can handle Aggregation Framework queries?

Hi,
This is my query to tmongodbinput "{createdDate : { $gte :{\"$date\":\"2014-01-01T00:00:00Z\"}, $lte :{\"$date\":\"2014-01-31T00:00:00Z\"}} }" . I want to replay the values with parameters  (greater than yesterday date and less than today). How do i do that.

You can use 
"{created:{ $gte :{$date:'"+context.StartDate+"'}, $lt :{$date:'"+context.EndDate+"'}}}"
and define the dates in contextvariable