Emil Sarkissian created NIFI-6293:
-------------------------------------

             Summary: MongoDB Aggregation does not parse dates
                 Key: NIFI-6293
                 URL: https://issues.apache.org/jira/browse/NIFI-6293
             Project: Apache NiFi
          Issue Type: Bug
          Components: Extensions
    Affects Versions: 1.9.2
         Environment: Ubuntu 16.04, MongoDB 4.0.3, TLS to MongoDB.
            Reporter: Emil Sarkissian


*Repro Steps*:
 # Create a "Generate Flow File" Processor to kick off things
 # Connect that to a Nifi MongoDB Aggregation Processor
 # Set the query to a $match with date criteria, for example:
{code:java}
[ { "$match": { "someDate": { "$gt": "2019-01-01T00:00:00Z" } } } ]{code}
 

*Expected Result*: Query returns correct documents per the date criteria.

*Actual Result*: Condition always evaluates to false and no documents are 
returned.

*Notes:*
 # I have tried every possible way to make this work, including \{ "$date": 
"2019-01-01T00:00:00Z" } and also using "$expr" with Mongo, as well as 
"$dateFromString", and "$convert".
 # Using an "$expr" seems to work functionally but refuses to use any indexes - 
probably a MongoDB issue (4.0.3 is what I run) and introduces unnecessary 
complexity.

I have fixed this for our fork, as we need to go to Production soon, but I am 
new to the contribution process and didn't want to just put a feature branch 
without explaining the issue.

The fix is to provide a Jackson custom deserializer to handle dates based on 
what Date Format is specified on the processor.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to