ListCollectionsAsync()

Lists all collections in the database.

public async Task<ListCollectionsResp> ListCollectionsAsync(ListCollectionsReq request, CancellationToken cancellationToken = default)

Request Syntax

var request = new ListCollectionsReq
{
    OnlyShowLoaded = true
};

ListCollectionsResp result = await client.ListCollectionsAsync(request);

REQUEST PARAMETERS:

  • DatabaseName (string?) -

    An optional database name to operate on. When empty, the client’s currently selected database is used.

  • OnlyShowLoaded (bool) -

    When true, only loaded collections are returned. When false (default), all collections are returned.

RETURN TYPE:

Task

RETURNS:

A ListCollectionsResp object that contains the list of collections and their metadata.

ListCollectionsResp
    CollectionNames      // -> IReadOnlyList<string>
    CollectionIds        // -> IReadOnlyList<long>
    CreatedTimestamps    // -> IReadOnlyList<ulong>
    CreatedUtcTimestamps // -> IReadOnlyList<ulong>
    InMemoryPercentages  // -> IReadOnlyList<long>
    ShardsNums           // -> IReadOnlyList<int>

PARAMETERS:

  • CollectionNames (IReadOnlyList) -

    The names of the collections.

  • CollectionIds (IReadOnlyList) -

    The IDs of the collections.

  • CreatedTimestamps (IReadOnlyList) -

    The hybrid timestamps at which the collections were created, aligned with CollectionNames.

  • CreatedUtcTimestamps (IReadOnlyList) -

    The UTC timestamps at which the collections were created, aligned with CollectionNames.

  • InMemoryPercentages (IReadOnlyList) -

    The percentage of each collection loaded into memory, aligned with CollectionNames.

  • ShardsNums (IReadOnlyList) -

    The number of shards of each collection, aligned with CollectionNames. A value of zero means the collection predates stored shard counts; the server derives the value from its virtual channels.

EXCEPTIONS:

  • MilvusException

    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.Collection;
using Milvus.Client.V2.Responses.Collection;

using var client = new MilvusClientV2(new ConnectConfig
{
    Uri = "localhost:19530",
    Username = "root",
    Password = "Milvus"
});
await client.ConnectAsync();

ListCollectionsResp result = await client.ListCollectionsAsync(new ListCollectionsReq
{
    OnlyShowLoaded = true
});

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?