nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy LoPresto <alopre...@apache.org>
Subject Re: Representing date queries properly with GetMongo
Date Fri, 23 Jun 2017 14:08:24 GMT
Mike,

The query is failing JSON validation because the value of the “$gte” key is not valid
JSON. You should be able to use a combination of NiFi Expression Language [1] and the UpdateAttribute
processor [2] to populate the expected date value in your query. Once NIFI-4082 [3] is implemented,
you won’t need the UpdateAttribute processor anymore.

[1] https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
[2] https://stackoverflow.com/a/44585760/70465
[3] https://issues.apache.org/jira/browse/NIFI-4082 <https://issues.apache.org/jira/browse/NIFI-4082>

Andy LoPresto
alopresto@apache.org
alopresto.apache@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Jun 23, 2017, at 9:06 AM, Mike Thomsen <mikerthomsen@gmail.com> wrote:
> 
> I am trying to write a query for GetMongo that gives me documents added in
> the last five minutes. It looks like this:
> 
> {
>    "ts": {
>        "$gte": new Date(ISODate().getTime() - (1000 * 60 * 5))
>    }
> }
> 
> The processor goes to an invalid state because it says "query validated
> against [that query] is invalid because org.bosn.json.JsonParseException."
> Does anyone know how to convert that query from the Mongo command
> shell-acceptable syntax into one NiFi can accept?
> 
> Thanks,
> 
> Mike


Mime
View raw message