UseDatabaseAsync()
Switches the default database for this client.
public Task UseDatabaseAsync(UseDatabaseReq request, CancellationToken cancellationToken = default)
Request Syntax
var request = new UseDatabaseReq
{
DatabaseName = "book_db"
};
await client.UseDatabaseAsync(request);
REQUEST PARAMETERS:
DatabaseName(string) -The name of the database to switch to.
RETURN TYPE:
Task
RETURNS:
This method does not return a value.
EXCEPTIONS:
-
Thrown when the RPC fails or the server returns an error. Inspect the exception message for details.
Example
using Milvus.Client.V2;
using Milvus.Client.V2.Requests.Utility;
using Milvus.Client.V2.Types;
using var client = new MilvusClientV2(new ConnectConfig
{
Uri = "localhost:19530",
Username = "root",
Password = "Milvus"
});
await client.ConnectAsync();
await client.UseDatabaseAsync(new UseDatabaseReq
{
DatabaseName = "book_db"
});