json
sample
Sample visible JSON documents.
strata json sampledb.json.sample(prefix: 'Optional[str]' = None, *, count: 'Optional[int]' = None) -> 'Sample'wire json_sample
Returns a bounded sample of visible JSON documents plus the total matching count. Useful for inspecting document shape before writing queries or indexes.
Paginated responses use opaque cursors. Clients should pass the returned cursor back to the same command shape and must not parse cursor contents.
To see the complete help for this command, run:
strata json sample --helphelp(db.json.sample)
Example
A representative sample plus the total population size.
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
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| branch | string or null | no | Target branch. Defaults to the executor handle branch. |
| count | integer or null | no | Optional sample count. Defaults to 10. |
| prefix | string or null | no | Optional document key prefix. |
| space | string or null | no | Target product space. Defaults to `"default"`. |
Returns
SamplePage<JsonSampleItem>
- dataobject
Shared pagination continuation facts.
- typestring
Errors
Recover by code. Retry policy and commit outcome come from the shipped error registry.
| Code | Retry | Commit outcome |
|---|---|---|
| failed_precondition.engine.runtime_closed | never | not_started |
| not_found.engine.branch | never | not_applicable |
| invalid_argument.engine.product_space | never | not_started |
| invalid_argument.engine.json_document_id | never | not_started |