Skip to main content

Delete()

This method deletes the entities that match the specified filtering conditions from a collection.

func (c *GrpcClient) Delete(ctx context.Context, collName string, partitionName string, expr string) error

Request Parameters

Parameter

Description

Type

ctx

Context for the current call to work.

context.Context

collName

Name of the collection from which entities are deleted.

string

partitionName

Name of the partition to update or insert data into.

string

expr

Boolean expression for metadata filtering.

For details, refer to Scalar Filtering Rules.

string

Return

Null

Errors

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

  • ErrClientNotReady: The client is not connected to Milvus.

  • ErrCollectionNotExists: The collection with the specified name does not exist.

  • The specified entity does not exist.

  • The call to this API fails.

Example

// delete by expr
errDelete := mc.Delete(context.Background(), collectionName, "", "id < 10")
if errDelete != nil {
log.Fatal("failed to delete data:", errDelete.Error())
}