SurrealDB Docs Logo

Enter a search query

.InsertRelation<T>()

Inserts one or multiple relations in the database.

Method Syntax
await db.InsertRelation<T>(table, data)

Arguments

ArgumentsDescription
table optional

Optionally pass along a table to insert into.

data optional

Either a single document/record or an array of documents/records to insert

cancellationToken optional

The cancellationToken enables graceful cancellation of asynchronous operations.

Example usage

await db.InsertRelation( new WroteRelation { In = ("user", "u1"), Out = ("post", "p1"), CreatedAt = now, NumberOfPages = 144 } );

On this page

© SurrealDB GitHub Discord Community Cloud Features Releases Install