• Start

Languages

/

Mojo

/

Methods

merge

The merge() method for the SurrealDB Mojo SDK merges data into a record.

Merges data into all records in a table, or a specific record, leaving unspecified fields untouched. This is a convenience wrapper that runs UPDATE <thing> MERGE <data_json>;.

Method Syntax

client.merge(thing, data_json, session, txn)
ArgumentDescription
thingThe table or specific record to merge into.
data_jsonThe data to merge, as a JSON string.
sessionAn optional session id.
txnAn optional transaction id.
var resp = client.merge("person:chiru", '{ "age": 31 }')
UPDATE $thing MERGE $data_json;

Was this page helpful?