• Start

Languages

/

Mojo

/

Methods

create

The create() method for the SurrealDB Mojo SDK creates a record in the database.

Creates a record in the database. This is a convenience wrapper that runs CREATE <thing> CONTENT <content_json>;.

Method Syntax

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

Was this page helpful?