CLI Overview
This documentation provides a complete guide to using the LioranDB V2 Pre-Alpha CLI. It covers the available commands, configuration options, and essential CLI workflows for managing and interacting with LioranDB.
Install
npm i -g @liorandb/cli@1.0.6
The installed executable is:
liorandb
What the CLI actually does
The liorandb binary is a source-backed wrapper around @liorandb/driver.
Its job is not to replace the driver protocol logic, but to add operator
workflow features on top of the real driver APIs.
From the current source, the CLI is responsible for:
- persisting local profiles
- persisting per-profile refresh-token sessions
- validating and storing connection strings
- resolving output modes for humans and automation
- prompting before destructive actions
- exposing direct data-plane commands
- exposing admin and cluster maintenance commands
- running an interactive shell with completion and history
Global options
The root command in src/cli.ts registers these global options:
--profile <name>: select a saved CLI profile--url <url>: override the stored URL for the current command only--output <format>: choosetable,json,ndjson, orquiet--json: shortcut for--output json--quiet: shortcut for--output quiet--no-color: disable ANSI colors--debug: include stack traces and lower-level driver diagnostics in errors
Behavior notes from the source:
--jsonand--quietare formatting shortcuts, not separate commands--urlchanges runtime behavior only and does not rewrite stored config--profilechanges both config lookup and session lookup--debugaffects rendering when a command fails
Command map
Setup and config
initset urlset outputset dbset metrics-urlget urlget outputget metrics-urlconfigprofile listprofile create <name>profile use <name>profile show <name>profile delete <name>
Authentication and sessions
loginlogoutwhoamisessionsrevoke-sessionchange-passwordauth loginauth logoutauth whoamiauth sessionsauth revoke-sessionauth change-password
Database, collection, and direct document commands
db list | create | drop | use | currentcollection list | create | dropfindfind-onefind-by-idscountinsert-oneinsert-manyupdate-oneupdate-manydelete-onedelete-manyaggregate
Index commands
index listindex createindex create-textindex drop
Admin commands
user list | show | create | update | delete | reset-password | revoke-sessionsrole list | show | create | update | deletepermission listsettings show | get | setsettings performance show | setsettings limits show | setsettings backups show | setsettings cors show | setcors list | add | remove
Operational commands
statushealthdoctormetricsstatscluster status | nodes | partitions | health | readiness | checkpoint | compactbackup list | create | show | verify | delete | restore | restore-job
Interactive mode
shell
Typical first local flow
liorandb init
liorandb set url liorandb://admin:YOUR_PASSWORD@127.0.0.1:27018/default
printf '%s' "$LIORANDB_PASSWORD" | liorandb login admin --password-stdin
liorandb db use default
liorandb collection create products
printf '{"sku":"bk-001","title":"Blue Notebook","active":true}' | liorandb insert-one products --stdin
liorandb count products
liorandb shell
Output modes
The shared printer supports four modes.
table
Default human-readable output. Best for:
user listcluster nodesfind products
json
Pretty-printed JSON for one logical result payload. Best for:
- automation with
jq - inspecting exact field names
- debugging server replies
ndjson
One compact JSON object per line. Best for streaming record sets such as:
find
quiet
Minimal output. Best for:
- CI scripts that only need exit status
- destructive operations where log noise should stay low
Representative usage:
liorandb find users --filter "{\"active\":true}" --json
liorandb find users --filter "{\"active\":true}" --output ndjson
liorandb cluster checkpoint --yes --quiet
Local storage model
The CLI stores two separate local state categories.
Config storage
Managed through conf in src/config/config-store.ts.
Stored fields include:
- current profile name
- per-profile URL
- per-profile output mode
- per-profile selected database
- per-profile raw metrics URL
Session storage
Managed through src/auth/session-store.ts.
Stored fields include:
- refresh token
- session id
- username
- user id
- update timestamps
Not stored:
- plaintext passwords
- short-lived access tokens
By default, session state lives under a .liorandb/state directory. The exact
root can be overridden with LIORANDB_STATE_DIR.
Safety model
The CLI includes several built-in safety checks from the real source:
db dropprompts unless--yescollection dropprompts unless--yesdelete-manyrequires typing the collection name when the filter matches everythingbackup deleteprompts unless--yesbackup restorerequires explicit restore confirmation unless--yes- shell input is parsed by a restricted JSON-like parser instead of arbitrary JavaScript
Mental model
global flags
-> runtime context
-> selected profile
-> output mode
-> stored or overridden URL
command handler
-> config/session lookup
-> authenticated driver client when needed
-> validation and safety prompts
-> shared printer