json
batch_set
Set multiple JSON values in one itemwise batch.
db.json.set_many(entries: 'Any') -> 'BatchResult'wire json_batch_set
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.
Itemwise batches return one positional item result per input item. The outer batch status summarizes whether all, some, or none of the items succeeded.
To see the complete help for this command, run:
help(db.json.set_many)
Example
Write many documents in one commit.
_ = 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": "$"}])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| entries | array | yes | Entries to set. |
| 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
BatchResult<JsonMutationItem>
- dataBatchResult3
- 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_not_found | never | not_started |
| invalid_argument.engine.json_path_type | never | not_started |
| invalid_argument.engine.json_value | never | not_started |
| invalid_argument.engine.json_document_too_large | never | not_started |
| invalid_argument.engine.json_document_too_deep | never | not_started |
| invalid_argument.engine.json_array_too_large | never | not_started |
| invalid_argument.executor.json_batch_duplicate_key | never | not_started |