Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

NiFi RunMongoAggreation - How to get all documents within a time range?

Highlighted

NiFi RunMongoAggreation - How to get all documents within a time range?

New Contributor

I am trying to get all documents within a time range using RunMongoAggreation.

In console I tried with below query and it worked fine.

db.collection.find(
{ "header.timestamp": {
        $gte: ISODate("2018-12-20T05:19:35.904Z"),
        $lt: ISODate("2018-12-20T05:21:44.509Z")
    } }
)

Flowfile has below properties

startTimestamp: 2018-12-20T05:19:35.904Z

endTimestamp: 2018-12-20T05:21:44.509Z

Below is the query being used in RunMongoAggreation

{
  "header.timestamp": {
    "$gt": {
      "$date": "${startTimestamp}"
    },
    "$lt": {
      "$date": "${endTimestamp}"
    }
  }
}

Its not working gettting below exception

com.fasterxml.jackson.databind.exc.mismatchedinputexception cannot deserialize instance of `java.util.arraylist` out of START_OBJECT token