json
delete
Delete a whole JSON document or one path inside it.
strata json deletedb.json.delete(key: 'str', path: 'str' = '$') -> 'Any'wire json_delete
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.
Successful mutations return an acknowledgement of the outcome: for a state-changing write, the affected target with the mutation effect and commit facts; for mutations that produce a domain result (such as a branch or a promotion outcome), that result object.
To see the complete help for this command, run:
strata json delete --helphelp(db.json.delete)
Example
Delete a document.
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")
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| key | string | yes | Document key. |
| path | string | yes | JSON path. |
| branch | string or null | no | Target branch. Defaults to the executor handle branch. |
| space | string or null | no | Target product space. Defaults to `"default"`. |
Returns
MutationAck<JsonDelete>
- dataobject
- 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 |
| invalid_argument.engine.json_path | never | not_started |
| invalid_argument.engine.json_path_too_long | never | not_started |
| invalid_argument.engine.json_path_type | never | not_started |