# MongoDB

UI Bakery allows you to easily connect to a MongoDB database with no need for additional layers like APIs or third-party services.

## Configuration

### Prerequisites

If your database is hosted behind a Firewall, you need to add our [IP addresses](https://docs.uibakery.io/concepts/data-sources#whitelisting-ip-addresses) to the Firewall whitelist.

### Connecting the data source

1. On the **Data sources** page, click **Connect**, and select *MongoDB* in the Data sources list.
2. Specify your connection string and click **Test connection** to check whether the data source can be connected.
3. Finally, click **Connect Datasource** to complete the setup.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FK5hSzHSPeQV2kYZKnyzC%2FCleanShot%202025-04-22%20at%2015.43.35%402x-min.png?alt=media&#x26;token=c8e9fd36-ad88-4d14-b981-8648b8e180db" alt=""><figcaption></figcaption></figure>

UI Bakery will extract the database structure and store column types. This data will be used to suggest the proper[ table columns and form field types](https://docs.uibakery.io/concepts/components/work-with-components/field-types-and-types-recognition).

If you need to be able to override the default data source database with a custom value in an action, you can enable the **Allow override database name in action** setting.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FiNguJ5v2UTLmgNuVBT3O%2FCleanShot%202025-04-22%20at%2015.47.21%402x-min%20(2).png?alt=media&#x26;token=630dd6b7-6982-4917-b5da-a57ac53abc11" alt=""><figcaption></figcaption></figure>

Once enabled, when configuring the action, you will be able to specify a custom database. In case a database is not specified, the default data source database will be used.

## Usage

Once you have established the connection between UI Bakery and MongoDB, you can access its data - load it and send it back.

The following *Action steps* are supported with MongoDB:

* [Load Table](https://docs.uibakery.io/reference/working-with-actions/load-table-action)
* [Load Row](https://docs.uibakery.io/reference/working-with-actions/load-row-action)
* [Create Row](https://docs.uibakery.io/reference/working-with-actions/create-row-action)
* [Bulk Create Rows](https://docs.uibakery.io/reference/working-with-actions/bulk-create-rows-action)
* [Update Row](https://docs.uibakery.io/reference/working-with-actions/update-row-action)
* [Delete Row](https://docs.uibakery.io/reference/working-with-actions/delete-row-action)
* [Bulk Delete Rows](https://docs.uibakery.io/reference/working-with-actions/bulk-delete-rows-action)
* [MongoDB Command](https://docs.uibakery.io/reference/working-with-actions/mongodb-command)
