### Managing tables in a MongoDB connection

A table contains fields mapped to attributes, top level documents, simple elements, array elements and other nodes in MongoDB documents. Queries can be built on these tables and a report is developed from a query or something else which is functionally similar.

This document shows how to add more tables to a MongoDB connection, refresh the tables, and so on.

#### Adding tables

To add tables which are transformed from a MongoDB file to a MongoDB connection, follow the steps below:

1. Do either 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 Table from the shortcut menu.
   - Right-click an existing table in the MongoDB connection if there is and select New Table from the shortcut menu.

   The Add Table dialog appears. See the dialog.

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

#### Refreshing tables

The tables in your catalog are a temporary cache to improve the performance when you design and test your report. Your data source may change over the time; however, these changes will not be reflected automatically in your catalog. To synchronize your tables in the connection and data source, you can choose to refresh the table information using the Refresh command on the shortcut menu of the table. Then when the refreshing job is done, a reporting dialog will be shown, summarizing the changes and operations that have been taken.

#### Removing and adding columns to tables

By default, when you add a table, you add all the columns that reside in the table. However, JReport gives you the flexibility to remove columns from a table, leaving only the columns useful to your reports. To remove a column from a table, right-click the column and select Delete from the shortcut menu.

Also, you can add the columns back into a table after you have removed them. To do this:

1. Right-click the table to which you want to insert columns, then select Insert Column from the shortcut menu.
2. In the Add Column dialog, select the required columns from the Columns box and click Add to add the columns to the table.

   There will be no available columns in the Columns box if you have not previously deleted columns.

3. Click the Done button to close the Add Column dialog.

Tip: If you want to add all the columns in a table at one time, you can also choose to refresh the table, which synchronizes the table in the catalog with the one in your database.