AddCollectionStructField()
Adds a struct (array-of-structs) field to an existing collection.
pub async fn add_collection_struct_field(&self, request: AddCollectionStructFieldRequest) -> Result<()>
Request Syntax
let request = AddCollectionStructFieldRequest::builder()
.collection_name("books")
.struct_field(
StructFieldSchema::new()
.name("events")
.max_capacity(16)
.nullable(true)
.add_field(
FieldSchema::new()
.name("embedding")
.data_type(DataType::FloatVector)
.dimension(128),
),
)
.build()?;
REQUEST FIELDS:
database_name: Option<String>Name of the target database; uses the default database when empty.
collection_name: StringName of the collection to alter. Required.
struct_field: Option<StructFieldSchema>The
StructFieldSchemadescribing the new struct field. Adding a struct field to an existing collection requiresnullable(true). Required.
RETURN TYPE:
Result<()>
RETURNS:
Returns an empty result indicating success. Returns Error on failure.
Example
let request = AddCollectionStructFieldRequest::builder()
.collection_name("books")
.struct_field(
StructFieldSchema::new()
.name("events")
.max_capacity(16)
.nullable(true)
.add_field(
FieldSchema::new()
.name("embedding")
.data_type(DataType::FloatVector)
.dimension(128),
),
)
.build()?;
client.add_collection_struct_field(request).await?;