DeleteByPks()
This method deletes the specified entities from a collection.
func (c *GrpcClient) DeleteByPks(ctx context.Context, collName string, partitionName string, ids entity.Column) 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. |
|
| IDs of the entities to delete. |
|
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 pks
ids := entity.NewColumnInt64("id", []int64{0, 1})
errDelete := mc.DeleteByPks(context.Background(), collectionName, "", ids)
if errDelete != nil {
log.Fatal("failed to delete data:", errDelete.Error())
}