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

# MongoDB CLI

> CLI commands for MongoDB state store

# MongoDB CLI

## Docker Setup

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
docker run -d --name mongodb \
  -p 27017:27017 \
  mongo:7
```

## Quick Start

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Test connection
praisonai persistence doctor \
  --state-backend mongodb \
  --state-url "mongodb://localhost:27017"

# Run with state
praisonai persistence run \
  --state-backend mongodb \
  --state-url "$MONGODB_URI" \
  "Hello"
```

## Commands

### Doctor

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai persistence doctor \
  --state-backend mongodb \
  --state-url "mongodb://localhost:27017"
```

### Run with State

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai persistence run \
  --state-backend mongodb \
  --state-url "$MONGODB_URI" \
  --session-id my-session \
  "Process this"
```

## Python Test

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
python3 -c "
from praisonai.persistence import create_state_store
store = create_state_store('mongodb', url='mongodb://localhost:27017')
store.set('test', {'value': 1})
print('MongoDB OK:', store.get('test'))
"
```
