Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Mongo DB Tool Criteria is not working for date filter

Nipun
6 - Meteoroid

Hi Team,

 

I am stuck with a problem while using Mongo Db Input tool.

I want to extract the data from a particular date range but when i typed a query in criteria , it returns error. I have tried all the way but date filter is not working in it.

 

query is:

{ "createdDate": { $gt: ISODate("2016-05-27T14:47:23.148+0000") } }

 

Thanks in advance.

 

Regards

Nipun Garg

 

 

4 REPLIES 4
SophiaF
Alteryx
Alteryx

@Nipun could you please let us know which version of Alteryx you are using, and that the error message is?

Sophia Fraticelli
Senior Solutions Architect
Alteryx, Inc.
Nipun
6 - Meteoroid

Hi SophiaF

 

I am using Alteryx 2018.1

 

It is showing error:

Error: MongoDB Input (1): Got parse error at "$", position 19: "SPECIAL_EXPECTED": could not parse JSON document

Code I am using is:

{ "createdDate": { $gt: ISODate("2016-05-27T05:46:13.481+0000") } }

 

I have tried it through so many ways but still can't figure it out.

 

Thanks for the reply.

 

Regards

Nipun Garg

Nipun
6 - Meteoroid

Hi Team,

 

Can anyone help me on this.

 

Thanks in advance

 

Regards,

Nipun Garg

MikeSp
Alteryx
Alteryx

Hi @Nipun,

 

I happened to be looking through the community and noticed your post here after helping out with a case that you submitted. I wanted to post the resolution here in case someone else has the same issue.

 

The MongoDB drivers as of the 2018.x series have been upgraded to support MongoDB 3.4+, and these new drivers do not support shell mode commands when it comes to MongoDB. You'll need to update your criteria to use the Strict format in order for this to function correctly. Documentation on this can be found on MongoDB's website here:

 

https://docs.mongodb.com/v3.4/reference/mongodb-extended-json/

 

As an example, I believe your criteria would need to be converted to:

 

{ "createdDate": { "$gt" : { "$date" : "2018-03-10T05:30:27.058+0000"} } }

 

Thanks!

Mike Spoula
Senior Solutions Architect
Alteryx
Labels