Collection

Represents collection metadata in Milvus, including the collection schema and consistency settings. Returned by DescribeCollection().

type Collection struct {
    ID               int64
    Name             string
    Schema           *Schema
    PhysicalChannels []string
    VirtualChannels  []string
    Loaded           bool
    ConsistencyLevel ConsistencyLevel
    ShardNum         int32
    Properties       map[string]string
    UpdateTimestamp  uint64
}

PARAMETERS:

  • ID (int64) - The unique identifier of the collection.

  • Name (string) - The name of the collection.

  • Schema (Schema) - The collection schema, with field definitions and the primary key.

  • PhysicalChannels ([]string) - The physical message channels the collection uses.

  • VirtualChannels ([]string) - The virtual message channels the collection uses.

  • Loaded (bool) - Whether the collection is currently loaded.

  • ConsistencyLevel (ConsistencyLevel) - The consistency level of the collection.

  • ShardNum (int32) - The number of shards in the collection.

  • Properties (map[string]string) - The collection properties (e.g., TTL settings).

  • UpdateTimestamp (uint64) - The collection update timestamp, usually used for internal change detection.

Example

Demonstrates Collection usage.

import (
    "context"
    "fmt"

    "github.com/milvus-io/milvus/client/v2/milvusclient"
)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
    Address: "127.0.0.1:19530",
})
if err != nil {
    // handle error
}
defer cli.Close(ctx)

collection, err := cli.DescribeCollection(ctx, milvusclient.NewDescribeCollectionOption("quick_setup"))
if err != nil {
    // handle error
}
fmt.Println(collection.Name, collection.Schema)

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?