tMongoDBInput query for date gte

One Star

tMongoDBInput query for date gte

I have some documents in MongoDB that has a DateTime field
{"Name" : "a name", "InsertDate" : ISODate("2014-01-23T14:32:11.746Z")}
and I want to get all the document with InsertionDate greater than 2014-01-23 00:00:00.
I tried the following queries but doesn't work:
{"InsertDate": {"$gt":ISODate("2014-01-23T00:00:00Z")} (got Error com.mongodb.util.JSONParseException pointing to ISODate)
{"InsertDate": {"$gt":new Date("2014-01-23T00:00:00Z")} (got Error com.mongodb.util.JSONParseException pointing to new Date)
Some one suggested I should use a syntax like: {"InsertDate": {"$gt":{"$date":"2014-01-23T00:00:00Z"}} but does not produce the results I expect (got no Error from Talend but doesn't retrieve any document (probably this syntax is not supported by Mongo)).
Any suggestions on how to include in query?
I am using TOS for BigData and MongoDB 2.2.3.

Re: tMongoDBInput query for date gte

Please try to replace ISODate("2014-01-23T00:00:00Z")
{ "$date": "2014-01-23T00:00:00Z"} to see if it is OK with you.
Here is a on-line related doc for mongodb-extended-json
and stackoverflow articles and
Best regards
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.



Introduction to Talend Open Studio for Data Integration.


Downloads and Trials

Test drive Talend's enterprise products.