Jump to content
We've recently updated our Privacy Statement, available here ×
  • Installing Jaspersoft MongoDB connector in iReport Designer or Jaspersoft Studio


    mdahlman

    Important News

    The manual install steps on this page will soon be deprecated. This is great news! The reason these will be deprecated is that the MongoDB connector is now included with iReport Designer v4.5.1 and Jaspersoft Studio v1.0.9. The manual install steps are only needed if you need to keep working with older versions.

    Obtain and unzip MongoDB-connector-for-Jaspersoft-bin-0.5.0.zip

    Download it from the project release area.

    The following files are included:

    1. plugin/com-jaspersoft-ireport-mongodb.nbm
    2. WEB-INF/applicationContext-MongoDbDataSource.xml
    3. WEB-INF/bundles/MongoDbDataSource.properties
    4. WEB-INF/lib/commons-pool-1.6.jar
    5. WEB-INF/lib/mongo-java-driver-2.7.3.jar
    6. WEB-INF/lib/js-mongodb-datasource-0.5.0.jar

    Jaspersoft Studio

    Reports can be designed in iReport Designer or Jaspersoft Studio. Most Jaspersoft users work with iReport Designer today. But more and more people are adopting Jaspersoft Studio. Which one should you choose?

    • iReport Designer - If you have a project that will reach production quickly, choose iReport Designer. iReport Designer is the stable standard. It has been supported by Jaspersoft for years.
    • Jaspersoft Studio - If you already use Eclipse, then Studio will feel more intuitive. Studio has more cool features and more rough edges.

    The MongoDB plugin is delivered as part of Jaspersoft Studio v1.0.9 and later. Download it here

    iReport Designer

    The MongoDB plugin is already included in iReport Designer v4.5.1. Get it here. iReport Designer Professional doesn't include the MongoDB connector yet (it will soon!). Here's how to install the connector manually today.

    1. Choose the menu Tools -> Plugins.
    2. : From the tab "Downloaded" add the plugin file MongoDbPlugin-xxx.nbm

       

      01_Add_Plugin.png.f66fa7922193602dac74695544bf2e6f.png

    3. : After installing the plugin you must restart iReport Designer.
    4. Click the button "Report Datasources" to define a new connection to MongoDB.
    5. :

      02_Report_Datasources.png.8e73c821f0f0d7cdc120cd756089d162.png

    6. Add a new datasource of type "MongoDB Connection"
    7. :

      03_Add_Data_Source_iR_MongoDB.png.c85c30ab8f56b922fa8ca2d99eeea91d.png

    8. Set an appropriate url and test the connection
    9. :

      04_Data_Source_Properties_iR_MongoDB.png.48cd9a4b325ec518e229c0f18e661cd4.png

     

    Create a report

    The simplest way for a new user to create a new report is with the Report Wizard.

    1. File → New...
    2. Choose any template and click "Launch Report Wizard".
    3. Set the report name and location.
    4. Create a query to retrieve data.
    5. : There is no visual query editor, so the button "Design query" is inactive.
    6. : The Jaspersoft query language for MongoDB is documented here: Jaspersoft MongoDB Query Language

    Sample queries

    • Minimal:

    { 'collectionName' : 'accounts' }

    • Specify the fields returned and sort the results:

    {

         'collectionName' : 'accounts',

         'findFields' : {'name':1,'phone_office':1,'billing_address_city':1,'billing_address_street':1,'billing_address_country':1},

         'sort' : {'billing_address_country':-1,'billing_address_city':1}

    }

    • Filtered and parameterized:

    {

         'collectionName' : 'accounts',

         'findQuery' : {

              'status_date' : { '$gte' : $P{StartDate} },

              'name' : { '$regex' : '^N', '$options' : '' }

          }

    }

    • MapReduce job:

    {

      'collectionName' : 'zips',

      'sort' : {

        'value.population' : -1,

      },

      'mapReduce' : {

        'map' : 'function () {

                   emit (this.state, {population : this.pop});

                 }',

        'reduce' : 'function (key, values) {

                      var total = 0;

                      for( var index = 0; index                     total += valuesindex.population;

                      }

                      return {population : total}

                   }',

        'out' : 'totalPopulation'

      }

    }

    Starting with iReport Designer v4.5.1, MongoDB plugin will be included as part of the official release. Download it here

    See Also


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...