SurrealDB Docs Logo

Enter a search query

.delete()

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

Method Syntax
async db.delete<T,U>(thing,data)

Arguments

ArgumentsDescription
thing required

The table name or a RecordId to delete.

Example usage

// Delete all records from a table await db.delete('person'); // Delete a specific record from a table await db.delete(new RecordId('person', 'h5wxrf2ewk8xjxosxtyc'));

Translated query

This function will run the following query in the database.

DELETE $thing;

On this page

© SurrealDB GitHub Discord Community Cloud Features Releases Install