CLI Tool
Manage your jsondb.cloud data from the terminal with the @jsondb-cloud/cli command-line tool.
Installation
npx @jsondb-cloud/cliAuthentication
The CLI authenticates using API keys. Log in once and your credentials are stored locally.
# Log in with your API key
jsondb login
# Enter: API key, namespace, base URL
# Check current config
jsondb whoami
# Log out
jsondb logoutinfo
Environment Variables
You can also set
JSONDB_API_KEY, JSONDB_NAMESPACE, and JSONDB_BASE_URL as environment variables. Config is stored in ~/.config/jsondb/credentials.json.Document Operations
List collections
jsondb collections
List documents in a collection
jsondb documents users
Get a document
jsondb get users/usr_abc123
Create a document
echo '{"name":"Alice","email":"[email protected]"}' | jsondb create usersUpdate a document (full replace)
echo '{"name":"Alice Smith","email":"[email protected]"}' | jsondb update users/usr_abc123Patch a document (partial update)
echo '{"role":"admin"}' | jsondb patch users/usr_abc123Delete a document
jsondb delete users/usr_abc123
Import & Export
Push (import from file)
jsondb push users.json --to usersPull (export to file)
# Export to stdout
jsondb pull users
# Export to file
jsondb pull users -o users.json
# Export as CSV
jsondb pull users --format csv -o users.csvSchema Management
Get collection schema
jsondb schema get users
Set schema from file
jsondb schema set users < schema.json
Remove schema
jsondb schema remove users
Command Reference
| Command | Description |
|---|---|
jsondb login | Authenticate with API key |
jsondb logout | Remove stored credentials |
jsondb whoami | Show current config |
jsondb collections | List collections in namespace |
jsondb documents <coll> | List documents in collection |
jsondb get <coll/id> | Read a document |
jsondb create <coll> | Create document from stdin/file |
jsondb update <coll/id> | Replace document |
jsondb patch <coll/id> | Partial update |
jsondb delete <coll/id> | Delete document |
jsondb push <file> --to <coll> | Import from file |
jsondb pull <coll> | Export to stdout/file |
jsondb schema get <coll> | Get collection schema |
jsondb schema set <coll> | Set schema from file/stdin |
jsondb schema remove <coll> | Remove schema |