Alteryx Designer Desktop Discussions

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

MongoDB criteria: all data newer than current timestamp - 90 Days

Patrik
5 - Atom

I try to select all rows from a MongoDB, where the field "updatedOn" (Format: DateTime) is newer than the current Time - 90 Days.
My first try was: 

 {"updatedOn": {"$gt": new Date(ISODate().getTime() - 1000 * 3600 * 24 * 90)} } 

That gives me a parsing Error to JSON. Error: MongoDB Input (1): Got parse error at "D", position 28: "SPECIAL_EXPECTED": could not parse JSON document

Is it not possible to use thenew Date(ISODate().getTime() ? Or does anybody knows what I'm doing wrong ? 

Thx

Patrik

 

2 REPLIES 2
IkoIko
5 - Atom

Could you select All records from Mongo and use a standard Filter tool to do the T - 90?  Not the most efficient, but when it comes to Mongo, I am happy to settle for 'it works'

Patrik
5 - Atom

Yes, we could do that... that would work, but the main reason for this "updatedOn" Timestamp is that we don't have to read the whole Database. We have a performance issue with the MongoDB. 

Labels
Top Solution Authors