• Start

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

Method Syntax
client.create(thing, content_json, session, txn)

Argument

Description

thing

The table or specific record to create.

content_json

The record content as a JSON string.

session

An optional session id.

txn

An optional transaction id.

var resp = client.create("person", '{ "name": "Chiru", "age": 30 }')
CREATE $thing CONTENT $content_json;

Was this page helpful?