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.
Hello,
I have a Mongo Query which is extracting the subducument from a collection and projects its fields.
The query is working fine, but I am not able to put it into the Jaspersoft MongoDB Query which is necessary for getting the dataset!
I looked through https://community.jaspersoft.com/wiki/jaspersoft-mongodb-query-language
but without success.
Is anybody able to convert this statement into a working query for a jasper report?
db.getCollection('a').aggregate({
$unwind: "$b"
}, {
$project: {
attribute: "$b.attribute"
}
})
Any help would be highly appreciated!
3 Answers:
See latest comment on the bug report here: https://community.jaspersoft.com/jasperreports-server/issues/10886#comme...
It might not help for Studio but it might for JasperReports Server.
There was a change in MongoDB version 3.6. Per MongoDB docs (https://docs.mongodb.com/manual/reference/command/aggregate/#dbcmd.aggre...):
Changed in version 3.6: MongoDB 3.6 removes the use of aggregate command without the cursor option unless the command includes the explain option. Unless you include the explain option, you must specify the cursor option.
So, you just need to add an empty "cursor" document.
Also, pipeline needs to be an array.
So, your query in JR needs to be similar to the following example:
{ "runCommand": { "aggregate" : "{collection name}", "pipeline" : [ { "$match": { ... } }, { ... } ], "cursor": {} } }
It doesn't work even if the empty cursor block is given.
The issue is that the Jaspersoft mongodb Connector (js-mongodb-datasource-2.0.9.jar) - the code is expecting the result data as inline results ('results' field). But MongoDB 3.6 results a cursor.
So it gives a 'No results exception' . This requires code change in the js-mongodb-datasource-2.0.9.jar and needs to be rebuilt. I could n't find the source of this component any where.
Due to this issue, Jasper report is almost unusable in all typical reports with MongoDB 3.6 and 4.0
Please help to resolve this issue
any new updates on this issue ?
See latest comment on the bug report here: https://community.jaspersoft.com/mongodb-connector/issues/10886#comment-...
There is an updated js-mongodb-datasource-2.0.10.jar available at http://jaspersoft.artifactoryonline.com/jaspersoft/jaspersoft-repo/com/j....
Does it contains this fix?
How to apply this patch?
.
Ok.. so at the moment I think my query is correct.. but the problem seems to be the
"JRException: The 'cursor' option is required, except for aggregate with the explain argument"
Has anyone experience with this problem?
I also getting this error since upgrading to MongoDB 3.6.3. It only occurs when doing an aggregation query.
2018-03-05 10:15:32,130 ERROR GenericExceptionMapper,http-nio-8080-exec-3:50 - Unexpected error occurs
net.sf.jasperreports.engine.JRException: The 'cursor' option is required, except for aggregate with the explain argument
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.runCommand(MongoDbQueryWrapper.java:207)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.processQuery(MongoDbQueryWrapper.java:115)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.<init>(MongoDbQueryWrapper.java:93)
at com.jaspersoft.mongodb.query.MongoDbQueryExecuter.createDatasource(MongoDbQueryExecuter.java:104)
When specifying the options field using the jaspersoft-mongodb-query-language, i get the following error in the log:
2018-03-05 10:14:12,893 ERROR JRQueryExecuterAdapter,http-nio-8080-exec-7:155 - Error while executing query
net.sf.jasperreports.engine.JRException: unrecognized field 'options'
I've replaced the java driver in the server lib dir but the error persists.
I have gotten the exact same error after upgrading to MongoDB 3.6. Haven't found a solution either
Hi All - We are hitting the same issue in our deployment. Upgraded MongoDB to latest build and started getting this issue. Anyone found any hacks or fixed "jar".
Only MongoDB versions 3.0-3.4.1 are certified: https://community.jaspersoft.com/documentation/v710/tibco-jasperreports-server-supported-platform-datasheet
See latest comment on the bug report here: https://community.jaspersoft.com/mongodb-connector/issues/10886#comment-...