Jump to content
We've recently updated our Privacy Statement, available here ×

(Jasper report - MongoDbQuery - Aggregation framework)I cannot create a date interval condition with $match operator and comparison operators ($lte,$gte etc.)


csernak.adam001

Recommended Posts

Hello!

I would like to ask a little help with the Jasper - Mongo integration. So i have a mongo collection what store a receivedDate field and a lot of other data. I would like to get data which is in a specified date interval.
My query is: 

{ runCommand: {
    aggregate : "kvSignalObject",                          ------> Target collection
    pipeline : [
    {$limit:1000},                                                   -------> Limitation for testing
    {$match:{receivedDate:{$lte:$P{date}}}},        -------> Match condition (Which is not working)
    {$project:{signalType:1,receivedDate:1}}        -------> Target fields
    ]
}}

The "date" is a Jasper parameter. This type is java.util.Date() and his Default Value Expression is ("new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss-SSS'Z'").format(new java.util.Date())")
It is return nothing, or return JSONParser exception.How can i figure out the problem? If I change the parameter to "2017-09-17T08:19:25.337Z" for example which is a valid data (Copy paste from Mongodb), then it is return nothing too.

The question:
My query syntax wrong or the Jasper mongodbquery cant handle the mongo date type properly in aggregation.

Jasper Studio version: 6.3.0

Thanks in advance!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...