• Start

Methods

patch

The patch() method for the SurrealDB Mojo SDK applies a JSON Patch to a record.

Applies a JSON Patch to all records in a table, or a specific record. This is a convenience wrapper that runs `UPDATE PATCH ;`.

Method Syntax
client.patch(thing, patch_json, session, txn)

Argument

Description

thing

The table or specific record to patch.

patch_json

A JSON Patch array as a JSON string.

session

An optional session id.

txn

An optional transaction id.

var resp = client.patch("person:chiru", '[{ "op": "replace", "path": "/age", "value": 31 }]')
UPDATE $thing PATCH $patch_json;

Was this page helpful?