There are times when we might need more control over our MongoDB data source. In cases like these, it's possible to execute a MongoDB query using BeanShell. This allows us to call up the MongoDB JDBC classes to execute the query manually.
To get ready for this recipe, you will have to make sure your MongoDB instance is running.
We are going to add a new advanced data source:
In Report Designer, navigate to File | New.
Click on the Data tab in the top-right corner of Report Designer.
Right-click on the Datasets item in the list, select Advanced, and then Scriptable.
Set the Name query to Orders.
Copy and paste the following script into the Query window:
import com.mongodb.*; import org.pentaho.reporting.engine.classic.core.util.TypedTableModel; Mongo mongo = new Mongo("localhost", 27017); db = mongo.getDB("SteelWheels"); orders...