🚀 Try Zilliz Cloud, the fully managed Milvus, for free—experience 10x faster performance! Try Now>>

Milvus
Zilliz
< Docs
  • Go

ListCollections()

This method lists collections within the connected database.

func (c *GrpcClient) ListCollections(ctx context.Context, opts ...ListCollectionOption) ([]*entity.Collection, error)

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

opts

Extra settings for this request.

client.ListCollectionOption

client.ListCollectionOption

You can add extra settings to the ListCollections() request using the following methods.

Method

Description

WithShowInMemory(value bool)

Whether to include the load status of the collections in the returned list.

Return

A list of entity.Collection structs. An entity.Collection struct is as follows:

type Collection struct {
    ID               int64
    Name             string  
    Schema           *Schema // Not included
    PhysicalChannels []string
    VirtualChannels  []string
    Loaded           bool    // Controled by `WithShowInMemory()`
    ConsistencyLevel ConsistencyLevel
    ShardNum         int32
    Properties       map[string]string
}

notes

The schema field is not included in each of the structs in the list.

Errors

Any error in the execution of the request. Possible errors are as follows:

  • ErrClientNotReady: The client is not connected to Milvus.

  • The call to this API fails.

Example

// list collections
collections, errList := mc.ListCollections(context.Background(), client.WithShowInMemory(false))
if errList != nil {
   log.Fatal("failed to list collection:", errList.Error())
}
for _, c := range collections{
   log.Println(c.Name)
}

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?