{
"_id" : ObjectId("5a6fca214420c2302a6f8985"),
"report_date" : ISODate("2018-01-23T00:00:00.000+0000"),
...
}db.runCommand(
{
"aggregate" : "reports",
"pipeline" : [
{
"$match": {
"report_date": {
"$gte": ISODate("2017-01-23")
}
}
}
],
"cursor": {}
})db.runCommand(
{
"aggregate" : "reports",
"pipeline" : [
{
"$match": {
"report_date": {
"$gte": {"$date": "2017-01-23T00:00:00.000Z"}
}
}
}
],
"cursor": {}
})...
"$gte": {"$date": "2017-01-29T00:00:00.000Z"},
"$lt": {"$date": "2019-01-29T00:00:00.000Z"}
...Hi Jacek
Recent Jasper Report versions use MongoDB Java Driver version 2.7.3, which is quite outdated (current Java driver is version 3.7) so it’s possible that some queries are not translated as per newer MongoDB server versions. Notably, the Java driver 2.7.3 is not listed anymore in Java Driver compatibility list due to its age.
There are two things you could try:
Try running with an elevated log level (e.g. db.setLogLevel(2, 'query')) or elevated profiling level to determine the actual query passed on to MongoDB by the driver.
There is a short example on the Jasper Report page regarding date queries that you may be able to try:
{
'collectionName' : 'accounts',
'findQuery' : {
'status_date' : { '$gte' : $P{StartDate}, $lt: $P{EndDate} },
'name' : { '$regex' : '^N', '$options' : '' }
}
}
Other than that, I would recommend you to ask in the JasperSoft community regarding this query.
Best regards
Kevin