Using a BeanShell data source
In this recipe, we are going to create a BeanShell data source, just as we did in previous reporting recipes. This BeanShell data source, a lightweight scripting for Java (http://www.beanshell.org), will allow us to query data from MongoDB.
Getting ready
To get ready for this recipe, you first need to start the MongoDB server with the same database as that of the last chapter. You will also need to start the Pentaho BA Server using the server control scripts. Once it is started, you should be able to log in to the BI Server.
How to do it…
Proceed with the following steps:
In the PUC, navigate to File | New | CDE Dashboard.
Click on the Data Sources tab.
Expand the SCRIPTING Queries data source category.
Click on the Scriptable over Scripting data source.
Set the Name property to QUERY2.
Set the Language property to beanshell.
Click on the Query Editor button.
Copy and paste the following BeanShell script:
import com.mongodb.*; import org.pentaho.reporting.engine.classic...