SurrealDB Docs Logo

Enter a search query

.Relate()

Creates a relation between records.

Method Syntax
await db.Relate(table, @in, @out, data)

Arguments

ArgumentsDescription
thing required

The table name or a RecordId to create.

@in required

The edge of the relation.

@out required

The other edge of the relation.

data optional

The document / record data to insert.

cancellationToken optional

The cancellationToken enables graceful cancellation of asynchronous operations.

Example usage

var data = new WroteRelation { CreatedAt = DateTime.UtcNow, NumberOfPages = 14 }; await db.Relate<WroteRelation, WroteRelation>( "wrote", ("user", "one"), ("post", "one"), data );

On this page

© SurrealDB GitHub Discord Community Cloud Features Releases Install