The below code I have executed to delete a record from Milvus collection. There is no error but the respective record also not deleted.
Please recommend solution for this
from pymilvus import connections,Collection,db,utility,FieldSchema, CollectionSchema
def connectVectorDB(**conStrings):
try:
milvusDB = connections.connect(
#db_name=conStrings['dbName'],
host=conStrings['hostname'],
port=conStrings['port']
)
db.using_database(conStrings['dbName'])
return milvusDB
except Exception as err:
raise err
dbConnections = connectVectorDB(dbName='default',hostname="localhost",port='19530')
myCol = Collection('DocStrings')
expression = "docID == 445341931317291845"
myCol.delete(expr=expression)
myCol.flush()
A couple of questions first:
docId
defined as a primary key in the collection?Also in the example above you're using
==
which is not allowed before 2.3.2.Before version 2.3.2:
I.e. One may use boolean expressions like
expr = "book_id in [0,1]"
wherebook_id
is defined as primary key.Since 2.3.2 it is possible to delete entities not only by primary key, but also using complex boolean expressions:
It worth to mention that:
Strong
.Bounded
.See: https://milvus.io/docs/delete_data.md