• Start

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 MERGE ;`.

Method Syntax
client.merge(thing, data_json, session, txn)

Argument

Description

thing

The table or specific record to merge into.

data_json

The data to merge, as a JSON string.

session

An optional session id.

txn

An optional transaction id.

var resp = client.merge("person:chiru", '{ "age": 31 }')
UPDATE $thing MERGE $data_json;

Was this page helpful?