# MongoDB Guide (Beta)

Support for MongoDB is available in private beta for select customers. To gain access to the beta version, email us at [support@satoricyber.com](mailto:support@satoricyber.com).

It only takes a few minutes to get started with Satori. What you need is:

- Access to Satori's [management console](https://app.satoricyber.com/).
- The hostname of your MongoDB cluster, for example: `abc123.abcd.mongodb.net`.

## MongoDB Connection String Formats

MongoDB supports several topologies for different use-cases, each with its own connection string format. Satori supports the following MongoDB topologies:

- **mongodb (Standard)** \- use this option for stand alone.
- **mongodb+srv (DNS Seed List)** \- use this option for clusters hosted by MongoDB Atlas.

## Adding a MongoDB Data Store to Satori

Perform the following steps to add an MongoDB data store to your Satori account:

1. Login to the [**Satori Management Console**](https://app.satoricyber.com/).
2. In the **Data Stores view**, click the plus button to **add a new data store**.
3. Select the **MongoDB** option.
4. Enter an **informative name** for the data store, for example: _Web App DB_.
5. Enter the **Hostname** of your MongoDB database, for example: `abc123.abcd.mongodb.net`.
6. Choose the **MongoDB Topology**
7. Choose a **Data Access Controller** to use for this data store by selecting the **Cloud provider** and **Region**.
8. Click the **Add New Data Store** button.
9. You will be redirected to the **Data Stores list view**.

## Enabling Satori Authentication

To enable your data consumers to use temp credentials and personal access tokens you must activate these features for each of your data stores.

1. Go to the **Data Stores** view and select the **MongoDB** data store.
2. Click the **Authentication Settings** tab.
3. Go to the **Temporary Credentials** section and turn on the **Enable Satori Credentials** Toggle switch.
4. Enter the **username and password** used to connect to the data store. Satori stores credentials in an encrypted form.
5. To enable **Personal Access Tokens** for the data store turn on the **Enable personal access tokens for this data store** toggle switch.
6. Click **SAVE**.

## Connecting to a MongoDB Cluster via Satori

To connect to a MongoDB cluster with Satori use the Satori hostname that was generated by the management console. The hostname is located in the data store summary tab for the specific data store in the management console, for example: `abc123.abcd.us-east-1.a.p0.satoricyber.net`.

> **IMPORTANT NOTE** Satori supports the SCRAM-SHA1 and SCRAM-SHA256 authentication modes.

### Connecting with mongosh

To connect to a MongoDB cluster using mongosh enter the Satori generated hostname, for example:

`mongosh "mongodb+srv://abc123.abcd.us-east-1.a.p0.satoricyber.net/<DB_NAME>" --username <username>`

### Connecting with Studio 3T

To connect to a MongoDB cluster using Studio 3T replace the `Server` parameter to the Satori generated hostname, for example: `abc123.abcd.us-east-1.a.p0.satoricyber.net`.

### Connecting with DataGrip

To connect to a MongoDB cluster using DataGrip replace the `Host` parameter to the Satori generated hostname, for example: `abc123.abcd.us-east-1.a.p0.satoricyber.net`.

### Connecting with Python

To connect to a MongoDB cluster using Python, use the Satori generated hostname, for example:

```
import pymongo

client = pymongo.MongoClient(
    "mongodb+srv://<username>:<password>@abc123.abcd.us-east-1.a.p0.satoricyber.net"
)
client.sample_airbnb.find_one()
```

## Limitations

- MongoDB support is available for the following MonogDB versions: 4.4, 5, 5.1, 6, 7 and 8.
- The MongoDB REST API is not supported.
- The MonogDB Atlas web UI is not supported.
