Admin, Ops, and Shell
The CLI covers a lot more than login and CRUD. The source includes full admin and operational workflows.
User commands
From src/commands/user.ts, the CLI supports:
user listuser show <id-or-username>user create <username>user update <id>user delete <id>user reset-password <id>user revoke-sessions <id>
Useful flags:
user create --role <role...>user create --must-change-passworduser update --enableduser update --disableduser update --role <role...>user update --metadata <json>user delete --yes
Example:
liorandb user list
liorandb user create analyst --role read-only --must-change-password
liorandb user update 01K2USER --enabled --metadata "{\"team\":\"ops\"}"
liorandb user revoke-sessions 01K2USER
Role and permission commands
From src/commands/role.ts, the CLI supports:
role listrole show <id>role create <name>role update <id>role delete <id>permission list
Grant strings are parsed in the form:
Permission@cluster
Permission@db.collection
Example:
liorandb permission list
liorandb role create read-users --grant ReadDocuments@default.users
liorandb role update 01K2ROLE --grant ReadDocuments@default.users WriteDocuments@default.users
Settings and CORS
From src/commands/settings.ts, the CLI supports:
settings showsettings get <key>settings set <key> <value>cors listcors add <origin>cors remove <origin>
The settings layer has a useful source detail:
- it decodes strings like
true,false,null, numbers, objects, and arrays into human-readable values when printing - it validates JSON-looking values before sending them back
liorandb settings show
liorandb settings get max_connections
liorandb settings set max_connections 500
liorandb cors add https://app.example.com
liorandb cors list
Status, doctor, metrics, and stats
From src/commands/ops.ts, the main operations commands are:
statushealthdoctormetricsstats
Example:
liorandb status
liorandb doctor
liorandb metrics
liorandb metrics --raw --metrics-url http://127.0.0.1:27201/metrics
liorandb stats
Source-backed behavior worth knowing:
statuscombines unauthenticated liveness/readiness checks with authenticated cluster APIsdoctorruns lightweight checks for configuration, DNS, HTTP reachability, readiness, authentication, gRPC discovery, and cluster healthmetricswithout--rawderives a summary from authenticated APIsmetrics --rawfetches a literal metrics endpoint and requires either--metrics-url, a stored profilemetricsUrl, orLIORANDB_METRICS_URLstatusandmetricsboth support--watchand--interval <seconds>
Cluster commands
The cluster subgroup supports:
cluster statuscluster nodescluster partitionscluster healthcluster checkpointcluster compact
The source protects mutating cluster operations with confirmation prompts unless
--yes is passed.
liorandb cluster status
liorandb cluster nodes
liorandb cluster partitions
liorandb cluster checkpoint --yes
liorandb cluster compact --yes
Backup commands
From src/commands/backup.ts, the CLI supports:
backup listbackup createbackup show <id>backup verify <id>backup delete <id>backup restore <id>
Important safety behaviors in the source:
backup deleteprompts for confirmation unless--yesbackup restorerequires typingRESTORE <backup-id>unless--yesbackup restorealso supports--disable-safety-backupbackup create --scopeonly acceptsclusterorlocal_node
Example:
liorandb backup list
liorandb backup create --label nightly --scope cluster
liorandb backup show 01K2BACKUP
liorandb backup verify 01K2BACKUP
liorandb backup restore 01K2BACKUP
Interactive shell
The shell implementation in src/shell/repl.ts and src/shell/parser.ts
is one of the most detailed parts of the CLI.
Start it with:
liorandb shell
What the shell supports
- profile-aware prompt with current database
- persistent history
- tab completion for meta commands, databases, collections, and
db.<collection>.<operation> - multiline input
- safe JSON-like parsing instead of arbitrary JavaScript execution
- in-shell login and logout
Meta commands
The parser exposes these dot-commands:
.help.exit.quit.status.whoami.databases.use <database>.db.create <database>.db.drop <database>.db.current.collections.collection.create <name>.collection.drop <name>.collection.list.users.roles.permissions.metrics.stats.clear.history.login.logout
Data expressions
The shell supports:
db.users.find(filter?, options?)db.users.findOne(filter?, options?)db.users.insertOne(document)db.users.insertMany([documents])db.users.updateOne(filter, update, options?)db.users.updateMany(filter, update, options?)db.users.deleteOne(filter)db.users.deleteMany(filter)db.users.aggregate(pipeline)
Example session:
liorandb [default]> db.users.insertOne({name:'Ada', active:true})
{
"inserted_id": "01K2EXAMPLE"
}
7ms
liorandb [default]> db.users.find({active:true}, {limit: 10})
+------+--------+
| name | active |
+------+--------+
| Ada | true |
+------+--------+
1 document
4ms
JSON-like parser rules
The shell parser accepts:
- strict JSON
- single-quoted strings
- unquoted simple object keys
- multiline arrays and objects
It does not evaluate arbitrary JavaScript. That is a deliberate safety decision in the source.