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

# GridFS

> Set up a MongoDB connection for the GridFS file-storage resource.

GridFS stores files inside MongoDB (metadata in `fs.files`, content chunks in `fs.chunks`). The GridFS resource only needs a MongoDB connection URI plus a database name; the connection is set up exactly like the [MongoDB resource](/home/setup/mongodb).

## 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 usage, see the [Python GridFS resource](/python/resource/gridfs) or the [TypeScript GridFS setup](/typescript/setup/gridfs).
