UseDatabase()

Selects the database used by subsequent operations on this client and its clones.

pub fn use_database(&self, database: impl Into<String>) -> Result<()>

The call changes client-side routing metadata only; it does not create the database or verify that it exists. Passing an empty name resets the selection to the always-present default database.

Request Syntax

client.use_database("my_database")?;

PARAMETERS:

  • database: impl Into<String>

    Name of the database to select. An empty value resets the selection to the default database.

RETURN TYPE:

Result<()>

RETURNS:

Returns Ok(()) on success; returns an Error on failure.

See also

  • pub fn current_database(&self) -> String

    Returns the database currently selected by this client.

Example

client.use_database("my_database")?;
assert_eq!(client.current_database(), "my_database");

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?