JSON commands
16 commands. Each entry gives the invocation and an example, in the interface you pick; open the details for parameters, return shape and error codes.
batch_delete
Delete multiple JSON documents or paths in one itemwise batch.
db.json.delete_many(entries: 'Any') -> 'BatchResult'
Deletes multiple document/path entries and returns one positional mutation result per entry. Missing documents and paths are represented as no-op item results; applied items share one engine commit.
To see the complete help for this command, run:
help(db.json.delete_many)
Example
_ = db.json.set_many([{"key": "a", "path": "$", "value": {"v": 1}}])_ = db.json.delete_many([{"key": "a", "path": "$"}])db.json.exists("a")
batch_exists
Check existence for multiple JSON documents.
No CLI or Python spelling in this release. Wire type json_batch_exists.
Checks several JSON documents and returns positional boolean status values. The response preserves the input order.
View details →batch_get
Read multiple JSON values by document and path.
db.json.get_many(entries: 'Any') -> 'list[Any]'
Reads several document/path entries and returns positional item results. Each item records whether the value was found and includes version metadata when present.
To see the complete help for this command, run:
help(db.json.get_many)
Example
_ = db.json.set_many([{"key": "a", "path": "$", "value": {"v": 1}}, {"key": "b", "path": "$", "value": {"v": 2}}])db.json.get_many([{"key": "a", "path": "$"}, {"key": "b", "path": "$"}])
batch_set
Set multiple JSON values in one itemwise batch.
db.json.set_many(entries: 'Any') -> 'BatchResult'
Writes multiple document/path/value entries using the executor batch contract. Valid items share one engine commit; entries targeting the same document are merged in order into a single new document version.
To see the complete help for this command, run:
help(db.json.set_many)
Example
_ = db.json.set_many([{"key": "a", "path": "$", "value": {"v": 1}}, {"key": "b", "path": "$", "value": {"v": 2}}])db.json.get_many([{"key": "a", "path": "$"}, {"key": "b", "path": "$"}])
count
Count visible JSON documents.
strata json count
db.json.count(prefix: 'Optional[str]' = None, *, as_of: 'Optional[int]' = None, as_of_time: 'Optional[TimeLike]' = None) -> 'int'
Counts visible JSON documents in the selected branch and space, optionally constrained by a document key prefix.
To see the complete help for this command, run:
strata json count --helphelp(db.json.count)
Example
strata json set a $ {"v":1}strata json set b $ {"v":2}strata json count
_ = db.json.set("a", "$", {"v": 1})_ = db.json.set("b", "$", {"v": 2})db.json.count()
delete
Delete a whole JSON document or one path inside it.
strata json delete
db.json.delete(key: 'str', path: 'str' = '$') -> 'Any'
Deletes the root path `$` to remove the whole document, or a nested path to remove one field or array element. Missing documents and paths produce a no-op delete acknowledgement rather than an error.
To see the complete help for this command, run:
strata json delete --helphelp(db.json.delete)
Example
strata json set temp $ {"x":1}strata json delete temp $strata json exists temp
_ = db.json.set("temp", "$", {"x": 1})_ = db.json.delete("temp", "$")db.json.exists("temp")
exists
Check whether one JSON document exists.
strata json exists
db.json.exists(key: 'str') -> 'bool'
Returns a boolean status for one JSON document key without loading the stored document.
To see the complete help for this command, run:
strata json exists --helphelp(db.json.exists)
Example
strata json set user $ {"name":"alice"}strata json exists userstrata json exists absent
_ = db.json.set("user", "$", {"name": "alice"})db.json.exists("user")db.json.exists("absent")
get
Read the current or historical JSON value at a document path.
strata json get
db.json.get(key: 'str', path: 'str' = '$', *, as_of: 'Optional[int]' = None, as_of_time: 'Optional[TimeLike]' = None) -> 'Any'
Reads the JSON value at a path inside a document. Current reads return the value with commit metadata; passing a timestamp returns the bare value visible at that point in time. A missing document or path is a found-false result, distinct from a stored JSON null.
To see the complete help for this command, run:
strata json get --helphelp(db.json.get)
Example
strata json set user $ {"age":30,"name":"alice"}strata json get user $strata json get user $.namestrata json get absent $
_ = db.json.set("user", "$", {"name": "alice", "age": 30})db.json.get("user", "$")db.json.get("user", "$.name")db.json.get("absent", "$") is None
history
Read retained version history for one JSON document.
strata json history
db.json.history(key: 'str') -> 'Optional[list]'
Returns retained full-document history rows for a JSON document, newest first, including delete tombstones. A document with no retained history maps to an optional-read result.
To see the complete help for this command, run:
strata json history --helphelp(db.json.history)
Example
strata json history absentdb.json.history("absent") is Nonelist
List JSON document keys with optional prefix filtering.
strata json list
db.json.keys(prefix: 'Optional[str]' = None, *, limit: 'Optional[int]' = None, cursor: 'Optional[Any]' = None, as_of: 'Optional[int]' = None, as_of_time: 'Optional[TimeLike]' = None) -> 'Page'
Lists visible JSON document keys in byte order. Prefix, cursor, limit, and timestamp parameters constrain the page returned by the executor.
To see the complete help for this command, run:
strata json list --helphelp(db.json.keys)
Example
strata json set user:1 $ {"v":1}strata json set user:2 $ {"v":2}strata json set other $ {"v":3}strata json list --prefix user:
_ = db.json.set("user:1", "$", {"v": 1})_ = db.json.set("user:2", "$", {"v": 2})_ = db.json.set("other", "$", {"v": 3})db.json.keys("user:").items
sample
Sample visible JSON documents.
strata json sample
db.json.sample(prefix: 'Optional[str]' = None, *, count: 'Optional[int]' = None) -> 'Sample'
Returns a bounded sample of visible JSON documents plus the total matching count. Useful for inspecting document shape before writing queries or indexes.
To see the complete help for this command, run:
strata json sample --helphelp(db.json.sample)
Example
strata json set a $ {"v":1}strata json set b $ {"v":2}strata json set c $ {"v":3}strata json sample
_ = db.json.set("a", "$", {"v": 1})_ = db.json.set("b", "$", {"v": 2})_ = db.json.set("c", "$", {"v": 3})db.json.sample().total_count
scan
Scan JSON documents with values and version facts.
strata json scan
db.json.scan(start: 'Optional[str]' = None, *, limit: 'Optional[int]' = None, cursor: 'Optional[Any]' = None) -> 'Page'
Scans visible JSON documents starting at an optional document key. Each item includes the key, full document value, and commit metadata exposed by the executor output.
To see the complete help for this command, run:
strata json scan --helphelp(db.json.scan)
Example
strata json set a $ {"v":1}strata json set b $ {"v":2}strata json scan
_ = db.json.set_many([{"key": "a", "path": "$", "value": {"v": 1}}, {"key": "b", "path": "$", "value": {"v": 2}}])[row.value for row in db.json.scan()]
set
Set a JSON value at a document path, creating the document when missing.
strata json set
db.json.set(key: 'str', path: 'str', value: 'Any') -> 'Any'
Writes a JSON value at a path inside a document, creating the document and any missing intermediate objects when needed. Setting the root path `$` replaces the whole document; setting a nested path like `$.profile.name` updates one field and records a new document version.
To see the complete help for this command, run:
strata json set --helphelp(db.json.set)
Example
strata json set user $ {"age":30,"name":"alice"}strata json get user $
_ = db.json.set("user", "$", {"name": "alice", "age": 30})db.json.get("user", "$")
Indexes
index create
Create a JSON secondary index on a field path.
strata json index create
db.json.create_index(name: 'str', field_path: 'str', *, index_type: 'str' = 'tag') -> 'Any'
Creates a secondary index over one JSON field path with a numeric, tag, or text kind. Existing documents are indexed at creation and future writes maintain the index automatically. The current wire response is a transitional bare index definition.
To see the complete help for this command, run:
strata json index create --helphelp(db.json.create_index)
Example
strata json index create by_name $.name --index-type tagstrata json index list
_ = db.json.create_index("by_name", "$.name", index_type="tag")[i.name for i in db.json.list_indexes()]
index drop
Drop a JSON secondary index by name.
strata json index drop
db.json.drop_index(name: 'str') -> 'Any'
Drops the named JSON secondary index and its stored entries. Documents are unaffected. The current wire response is a transitional boolean status.
To see the complete help for this command, run:
strata json index drop --helphelp(db.json.drop_index)
Example
strata json index create by_name $.name --index-type tagstrata json index drop by_namestrata json index list
_ = db.json.create_index("by_name", "$.name", index_type="tag")_ = db.json.drop_index("by_name")[i.name for i in db.json.list_indexes()]
index list
List JSON secondary indexes.
strata json index list
db.json.list_indexes() -> 'list'
Lists JSON secondary index definitions in the selected branch and space, including each index's field path and kind.
To see the complete help for this command, run:
strata json index list --helphelp(db.json.list_indexes)
Example
strata json index create by_name $.name --index-type tagstrata json index list
_ = db.json.create_index("by_name", "$.name", index_type="tag")[i.name for i in db.json.list_indexes()]