> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MongoDB

> Set up a MongoDB connection for the MongoDB resource.

## Credentials

### 1. Get Your Connection URI

#### Local MongoDB

```bash theme={null}
# Default local instance
MONGODB_URI=mongodb://localhost:27017
```

#### MongoDB Atlas (Cloud)

1. Go to [https://cloud.mongodb.com](https://cloud.mongodb.com)
2. Select your cluster -> **Connect** -> **Drivers**
3. Copy the connection string:
   ```
   mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/
   ```

#### Self-hosted with Authentication

```bash theme={null}
MONGODB_URI=mongodb://username:password@host:27017/?authSource=admin
```

### 2. Set Environment Variables

```bash theme={null}
# .env.development
MONGODB_URI=mongodb+srv://user:pass@cluster0.xxxxx.mongodb.net/
```

For Python configuration, see the [Python MongoDB Setup](/python/setup/mongodb) guide.
