Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I'm trying to to put together a Aggregation Pipeline query in tMongoDBInput and it doesn't work(I get no records out) irrespective of whatever condition I use for filtering by date. If I remove the condition for date, everything works fine.
Attached a screenshot of what condition I have and the context value is 2017-06-24 08:07:28.113Z.
It would be great if somebody can provide some assistance.
Is there not a solution for this?
Hi,
Sorry for late response.
Can you successfully execute your filter by using 2017-06-24 08:07:28.113Z without using context value?
On which build version you got this issue?
Best regards
Sabrina
Hello Sabrina,
No problem. I use TOS Big Data 6.4.1.
This one - {$match: {order_date:{$gt: new Date("2017-06-24 08:07:28.113Z")}}}, works directly in the Mongo shell, but when I use it in MongodbInput as "{$match: {order_date:{$gt: new Date(\"2017-06-24 08:07:28.113'Z'\")}}}", I get the following error after the build,
Exception in component tMongoDBInput_1 (ItemInSalesOrder_Copy_Copy)
com.mongodb.util.JSONParseException:
{$match: {order_date:{$gt: new Date("2017-06-24 08:07:28.113'Z'")}}}
^
at com.mongodb.util.JSONParser.read(JSON.java:280)
at com.mongodb.util.JSONParser.parse(JSON.java:171)
at com.mongodb.util.JSONParser.parseObject(JSON.java:241)
at com.mongodb.util.JSONParser.parse(JSON.java:205)
at com.mongodb.util.JSONParser.parseObject(JSON.java:241)
at com.mongodb.util.JSONParser.parse(JSON.java:205)
at com.mongodb.util.JSONParser.parseObject(JSON.java:241)
at com.mongodb.util.JSONParser.parse(JSON.java:205)
at com.mongodb.util.JSONParser.parse(JSON.java:155)
at com.mongodb.util.JSON.parse(JSON.java:93)
at com.mongodb.util.JSON.parse(JSON.java:74)
at bd_newproject.iteminsalesorder_copy_copy_0_1.ItemInSalesOrder_Copy_Copy.tMongoDBInput_1Process(ItemInSalesOrder_Copy_Copy.java:2234)
at bd_newproject.iteminsalesorder_copy_copy_0_1.ItemInSalesOrder_Copy_Copy.runJobInTOS(ItemInSalesOrder_Copy_Copy.java:4619)
at bd_newproject.iteminsalesorder_copy_copy_0_1.ItemInSalesOrder_Copy_Copy.main(ItemInSalesOrder_Copy_Copy.java:4436)
When I change it this way - "{$match: {order_date:{$gt: '" + TalendDate.formatDate("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "2017-06-24 08:07:28.113'Z'") + "'}}}",
I get the error(attached), when I press run(before the build completes).
Hello Sabrina,
No solution yet?
Hello,
We are making an investigation on your issue and then come back to you as soon as we can.
Thank for your time.
Best regards
Sabrina
Thank you Sabrina. Will wait for your findings.
By the way, the datatype for the field in DB is Date.
Hello,
Could you please show us your query in tmongodbinnput?
Here are related success use cases and feel free to let us know if it helps for you.
https://community.talend.com/t5/Design-and-Development/aggregation-query-in-tmongoDBInput/m-p/54857
Best regards
Sabrina