CollectionDesc
This class represents the full schema and runtime metadata of a collection. It is returned by calling Desc() on a DescribeCollectionResponse object.
const CollectionDesc& desc = response.Desc();
METHODS:
const std::string& DatabaseName() constName of the database the collection belongs to.
const std::string& CollectionName() constName of the collection.
const std::string& Description() constHuman-readable description of the collection.
int64_t NumShards() constNumber of shards in the collection.
const CollectionSchema& Schema() constSchema of the collection, including field definitions and dynamic field settings. For details see CollectionSchema.
int64_t ID() constServer-assigned collection ID.
const std::vector<std::string>& Alias() constList of aliases attached to this collection.
uint64_t CreatedTime() constUTC timestamp (microseconds) when the collection was created.
uint64_t UpdateTime() constUTC timestamp (microseconds) of the last schema update.
const std::unordered_map<std::string, std::string>& Properties() constCollection-level properties as key-value pairs (e.g., TTL settings).
Example
#include <milvus/MilvusClientV2.h>
using namespace milvus;
auto client = MilvusClientV2::Create();
client->Connect(ConnectParam("http://localhost:19530").WithToken("root:Milvus"));
DescribeCollectionResponse response;
auto status = client->DescribeCollection(
DescribeCollectionRequest()
.WithCollectionName("my_collection"),
response);
if (!status.IsOk()) {
std::cout << status.Message() << std::endl;
}
const CollectionDesc& desc = response.Desc();
std::cout << "Name: " << desc.CollectionName() << "\n"
<< "ID: " << desc.ID() << "\n"
<< "Shards: " << desc.NumShards() << "\n"
<< "Fields: " << desc.Schema().Fields().size() << "\n";