• Start

Languages

/

Mojo

/

Methods

update

The update() method for the SurrealDB Mojo SDK updates all records in a table, or a specific record.

Updates all records in a table, or a specific record, replacing their content. This is a convenience wrapper that runs UPDATE <thing> CONTENT <content_json>;.

Method Syntax

client.update(thing, content_json, session, txn)
ArgumentDescription
thingThe table or specific record to update.
content_jsonThe replacement content as a JSON string.
sessionAn optional session id.
txnAn optional transaction id.
var resp = client.update("person:chiru", '{ "age": 31 }')
UPDATE $thing CONTENT $content_json;

Was this page helpful?