tMongoDBInput query for date gte

Highlighted
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.
Moderator

Re: tMongoDBInput query for date gte

Hi,
Please try to replace ISODate("2014-01-23T00:00:00Z")
with
{ "$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
http://docs.mongodb.org/manual/reference/mongodb-extended-json/
and stackoverflow articles http://stackoverflow.com/questions/19819870/date-query-with-isodate-in-mongodb-doesnt-seem-to-work and http://stackoverflow.com/questions/20561381/mongodb-nodejs-how-to-query-isodate-fields.
Best regards
Sabrina
--
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.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads