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

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.


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!

csernak.adam001's picture
Joined: Sep 11 2016 - 8:42am
Last seen: 4 years 8 months ago

0 Answers:

No answers yet