SurrealDB Docs Logo

Enter a search query

.select()

Selects all records in a table, or a specific record, from the database.

Method Syntax
async db.select<T>(thing)

Arguments

ArgumentsDescription
thing required

The table name or a RecordId to select.

Example usage

type Person = { id: string; name: string; }; // Select all records from a table const people = await db.select<Person>('person'); // Select a specific record from a table const person = await db.select<Person>(new RecordId('person', 'h5wxrf2ewk8xjxosxtyc')); const person = await db.select<Person>(new StringRecordId('person:h5wxrf2ewk8xjxosxtyc'));

Translated query

This function will run the following query in the database.

SELECT * FROM $thing;

On this page

© SurrealDB GitHub Discord Community Cloud Features Releases Install