• Start
Sign In

Methods

use_defaults

The .use_defaults() method for the SurrealDB Rust SDK selects the default namespace and database for this connection, if the server and client are configured to provide one.

Selects the namespace and database set by DEFINE CONFIG DEFAULT. If no default is configured, the session is left unchanged.

Method Syntax
db.use_defaults().await?

This complements use_ns() and use_db() when you want the configured default instead of a specific pair.

The defaults only fill in what is missing. A session that has already selected a namespace — from a token, for example — keeps that selection.

Was this page helpful?