> ## 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 VFS.

## Credentials

### 1. Get Your Connection URI

#### Local MongoDB

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

#### MongoDB Atlas (Cloud)

1. Create a database user and allow the application host through **Network Access**.
2. Select your cluster, then **Connect** → **Drivers**.
3. Copy the connection URI, replace its username and password, and
   percent-encode special characters in the credentials:
   ```
   mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/
   ```

See the Atlas [connection guide](https://www.mongodb.com/docs/atlas/connect-to-database-deployment/).

#### 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 SDK guides, see [MongoDB (Python)](https://docs.mirage.strukto.ai/python/vfs/mongodb.md) and [MongoDB (TypeScript)](https://docs.mirage.strukto.ai/typescript/setup/mongodb.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.