Support Questions

Find answers, ask questions, and share your expertise

Issues with query parameter in getmongo processor nifi

avatar
New Contributor

I am trying to write the below query in getMongo processor

 

{"updatedAt" : {$gt : 2022-12-10}}

But it is showing an error stating that query is not a valid JSON representation. I tried adding double quotes as well but when I run it, it doesn't show any error nor any results in success, failure or original nodes.

 

My end goal is to fetch incremental data i.e. only the new data added daily (day -1) using "updatedAt" field. Kindly help me with this 

3 REPLIES 3

avatar

@Jaimin7 assuming "gt" is your parameter, that would be referenced as #{gt} and i think would be:

 

{"updatedAt" : {#{gt} : 2022-12-10}}

 

If "gt" is your variable, that would be represented as ${gt} and that would then be:

 

{"updatedAt" : {${gt} : 2022-12-10}}

 

 

Preference going forward is to use Paramaters as Variables will be going away soon.

avatar
New Contributor

@steven-matison Hello, gt is supposed to be greater than right ? I want to have a date filter/condition stating my date column("updatedAt") should be greater than yesterday i.e. to fetch only the daily new records from my mongoDb database

avatar

Ahh my confusion, it is hard to assume without a lot more detail.

 

Reference: https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#gt

 

${fileSize:gt( 1024 )}

 You need to use the expression "gt( some value )" against a parameter or variable.  In the case above, "file size greater than 1024".