BackPrevious Topic  Next TopicNext

Working with MongoDB Connections in a Catalog

A MongoDB connection contains relational schemas which are transformed from the collections in a MongoDB database. This topic describes how you can set up MongoDB connections in a catalog, and add and manage schemas and tables transformed from MongoDB databases in the catalog via the connections.

This topic contains the following sections:

Setting Up MongoDB Connections in a Catalog

To connect a catalog to a MongoDB database, you can set up a MongoDB connection.

  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, select New Data Source on the Catalog Manager toolbar, then in the New Data source dialog box, specify the name of the data source, select the MongoDB connection type and select OK.

    Designer displays the MongoDB Connection Wizard dialog box.

    MongoDB Connection Wizard - MongoDB Connection Information

  2. In the MongoDB Connection Information screen, specify the necessary information to connect to the MongoDB server.
    • To connect by server host and port, select Information, then type the host and port of the MongoDB server, and the user ID and password to connect to the MongoDB server respectively.
    • To connect by URI, select URI and type the URI string. If a URI string contains characters, such as "@", ":", "?", and "&", or other strings that do not need to be parsed, quote them with double quotation marks.

    New Content of v18You can reference a parameter or constant level formula in the current catalog data source in the format @FieldName, or the special field "User Name" as @username when specifying the user ID and password, and use a combination of the three when specifying the host or URI string, to dynamically specify the information to connect to the MongoDB database. Select New Parameter to create the parameter and reference it if the predefined parameters cannot meet your requirement.

  3. Select Next to go to the next screen.
  4. If you specify to connect to the MongoDB server by host and port, Designer displays the Connection Options screen.

    MongoDB Connection Wizard - Connection Options

    Select Add Add button to add lines to specify the conditional replica set members for the MongoDB connection. To delete a replica set member, select it and select Remove Trash Can 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:

    • slaveOk=true|false
      If true, the driver connected to a replica set sends reads to slaves/secondaries, or you can also read a slave/secondary database by adding its URI and port to the Replica Set Members box.
    • safe=true|false
      If true, the driver sends a getLastError command after every update to ensure that the update succeeds.
    • w=n
      The driver adds { w : n } to the getLastError command. Implies safe=true.
    • wtimeoutMS=ms
      The driver adds { wtimeout : ms } to the getLastError command. Implies safe=true.
    • fsync=true|false
      If true, the driver adds { fsync : true } to the getLastError command. Implies safe=true.
    • journal=true|false
      If true, sync to journal. Implies safe=true.
    • connectTimeoutMS=ms
      How long a connection can take to be opened before timing out.
    • socketTimeoutMS=ms
      How long a send or receive on a socket can take before timing out.
    • authSource=<DataBase name>
      The database name associated with the credentials of the user ID if the user ID is specified in the MongoDB Connection Information screen.
    • ssl=true|false
      If true, the SSL certificate is imported into the default JKS when you set up the connection via SSL.

      Note icon When you create a MongoDB connection via SSL, to make the connection work at runtime, you need to add the -Djavax.net.ssl.trustStore parameter in Server's startup file JRServer.bat in <server_install_root>\server\bin, so that the SSL certificate can be loaded into Server.

  5. Select Next.
  6. In the Collection Filter screen, Designer lists all the available collections in the MongoDB database.

    By default, Designer uses the first ten 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 then specify the filter in the text box by typing the part after "$match:", for example, type {author:"dave"} in the text box (for more information about the definition of $match, see https://docs.mongodb.com/manual/reference/operator/aggregation/match/#pipe._S_match). Select Apply the Filter to Run Reports if you want to apply the filter conditions to the reports which use the collections at runtime.

    MongoDB Connection Wizard - Collection Filter

  7. In the Add Schema screen, add the collections you want to transform to relational schemas to use them in the catalog.

    MongoDB Connection Wizard - Add Schema

  8. Select Next.
  9. In the Add Table screen, add the tables that Designer transforms from the specified schemas to the 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

    You can create queries and business views using these tables and a report is developed from a query (or something else which is functionally similar) or from a business view.

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

Back to top

Adding More Schemas and Tables to a MongoDB Connection

After you have set up a MongoDB connection in a catalog, you can add more schemas transformed from the collections in the specified MongoDB database and tables in the schemas to the 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. Designer displays the Add Collection dialog box.

    Add Collection dialog box

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

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

  1. Do one of the following:
    • Right-click the MongoDB connection and select Add Tables from the shortcut menu.
    • Right-click the Tables node of the MongoDB connection and select Add Tables from the shortcut menu.
    • Right-click an existing table in the MongoDB connection and select Add Tables from the shortcut menu.

    Designer displays the Add Table dialog box.

    Add Tables dialog box

  2. In the Tables box, select the required tables transformed from the relational schemas and select Add Add button to add them to the Added Tables box.
  3. Select OK to close the dialog box.

Back to top

Managing Schemas in a MongoDB Connection

You can manage the schemas transformed from a MongoDB database via the MongoDB connection you set up in a catalog.

  • Refreshing schemas
    The schemas in your catalog are a temporary cache of metadata to improve performance when you design and test your report. Your database probably changes over the time; however, these changes cannot be reflected automatically in your catalog. To refresh all collection schema metadata from the MongoDB database, you can refresh the schema information using the Refresh command on the shortcut menu of the schema. When Designer finishes the refreshing job, it displays a reporting dialog box, summarizing the changes and operations that have been taken.

    Note icon If you want to add all the deleted or missing databases at one time, you can also refresh the schema, which refreshes all of the collection schema metadata from the MongoDB database.

  • Renaming databases of schemas
    Right-click the database and select Rename from the shortcut menu, and then type the required database name in the text box.
    • If the renamed database exists in the MongoDB database, it connects to the new database.
    • If the renamed database does not exist in the MongoDB database, no data is retrieved.
  • Removing databases of schemas
    Right-click the database and select Delete from the shortcut menu.

Back to top

Managing Tables in a MongoDB Connection

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

Back to top

BackPrevious Topic  Next TopicNext