You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Emil Sarkissian (JIRA)" <ji...@apache.org> on 2019/05/13 03:04:00 UTC

[jira] [Commented] (NIFI-6293) MongoDB Aggregation does not parse dates

    [ https://issues.apache.org/jira/browse/NIFI-6293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16838228#comment-16838228 ] 

Emil Sarkissian commented on NIFI-6293:
---------------------------------------

Actually, on further review of the other Mongo processors, it appears that we can use the `org.bson.Document.parse()` method to parse an extended JSON document which can contain things like `\{ "$date": "2019-01-01T00:00:00Z" }` and also `\{ "$oid": "5c5d1d00f3326101082209f2" }`.

> 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
>            Priority: Major
>              Labels: easyfix, newbie
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> *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)