BackPrevious Page Next PageNext

Working with MongoDB Connections in a Catalog

Setting up MongoDB connections in a catalog

Adding more schemas and tables to a MongoDB connection

Managing the schemas in a MongoDB connection

Managing the tables in a MongoDB connection

You can set up MongoDB connections in JReport catalogs to get data from MongoDB databases. A MongoDB connection contains relational schemas which are transformed from the collections in a MongoDB database. From the transformed relational schemas, you can add tables to the JReport catalog.

Setting up MongoDB connections in a catalog

To connect a JReport catalog to a MongoDB database, you can set up a MongoDB connection as follows:

  1. Create a catalog or open a catalog, then in the Catalog Manager, right-click the node of a data source and select New MongoDB Connection from the shortcut menu.

    If you want to set up the connection in a new data source in the catalog, select any of the existing catalog data sources, click New Data Source on the Catalog Manager toolbar, then in the New Data source dialog, specify the name of the data source, select the MongoDB connection type and click OK.

    The MongoDB Connection Wizard appears.

    MongoDB Connection Wizard - MongoDB Connection Information

  2. In the MongoDB Connection Information screen, specify the necessary information to connect to the MongoDB server.
  3. Click Next to go to the next screen.
  4. If you specified to connect to the MongoDB server by host and port, the Connection Options screen is displayed.

    MongoDB Connection Wizard - Connection Options

    Click Add button to add lines to specify the conditional replica set members for the MongoDB connection. To remove a replica set member, select it and click Remove button.

    In the Options box, specify the options of the MongoDB server. The options are name=value pairs separated by "&". You can specify the following:

  5. Click Next to go to the next screen.
  6. If you specified to connect to the MongoDB server by host and port but you haven't the privilege to access all the databases in the MongoDB database, the Add Database screen is displayed. Click Add button to add lines to specify the databases you can access in the MongoDB database. To remove a database, select it and click Remove button. Click Next.

    MongoDB Connection Wizard - Add Database

  7. In the Collection Filter screen, all available collections in the MongoDB database are listed. By default, JReport will use the first ten data records in each collection to parse metadata. If you want to edit the filter condition to get the required collection structure, select a collection in the Collection box and specify the filter in the $match text box (for the definition of $match, refer to https://docs.mongodb.com/manual/reference/operator/aggregation/match/#pipe._S_match). Check Apply the Filter to Run Reports if you want to apply the filter conditions to reports created based on the collections at runtime.

    MongoDB Connection Wizard - Collection Filter

  8. In the Add Schema screen, add the collections you want to transform to relational schemas so as to use in the JReport catalog. Click Next.

    MongoDB Connection Wizard - Add Schema

  9. In the Add Table screen, add the tables transformed from the specified schemas to the JReport catalog. A table contains fields mapped to attributes, top level documents, simple elements, array elements and other nodes in the MongoDB documents.

    MongoDB Connection Wizard - Add Table

    Queries and business views can be created based on these tables and a report is developed from a query (or something else which is functionally similar) or from a business view.

  10. Click Finish to confirm the transformed result and finalize the transformation process.

Adding more schemas and tables to a MongoDB connection

When a MongoDB connection is set up, you can add more schemas transformed from the collections in the specified MongoDB database and tables in the schemas to the JReport catalog via the MongoDB connection.

To add more schemas to the catalog via the MongoDB connection:

  1. Right-click the Schemas node or an existing schema in the MongoDB connection and select Add Collection from the shortcut. The Add Collection dialog appears.

    Add Collection dialog

  2. Select the required collections that you want to transform to relational schemas in the Collections box and then click Add button to add them to the Added Schemas box.
  3. After adding the required schemas, click OK to close the dialog.

To add more tables to the catalog via the MongoDB connection:

  1. Do either of the following:

    The Add Table dialog appears.

    Add Tables dialog

  2. Select the required tables that are transformed from the relational schemas in the Tables box and then click Add button to add them to the Added Tables box.
  3. After adding the required tables, click OK to close the dialog.

Managing the schemas in a MongoDB connection

You can manage the schemas transformed from a MongoDB database via the MongoDB connection you set up in a JReport catalog as follows:

Managing the tables in a MongoDB connection

When the tables transformed from a MongoDB database have been added into the JReport catalog via the specified MongoDB connection, you can refresh them, organize them into folders, and remove and add the table columns the same as you do on tables from a JDBC database.

BackPrevious Page Next PageNext