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 |
---|---|---|
| Context for the current call to work. |
|
| Name of the collection from which entities are deleted. |
|
| Name of the partition to update or insert data into. |
|
| Boolean expression for metadata filtering. For details, refer to Scalar Filtering Rules. |
|
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())
}