删除 Collection

最近更新时间:2024-09-27 18:00:11

我的收藏

接口定义

def drop_collection(self, name: str, timeout: Optional[float] = None)

使用示例

警告:
执行 drop 操作将会永久删除指定 Collection 下的所有数据。在操作之前,务必谨慎考虑。
db = client.database('db-test')
res = db.drop_collection(name='book-vector')
print(res, flush=True)

入参描述

参数名
是否必选
参数含义
配置方法
name
所需删除的 Collection 名称。
请使用 list_collections() 查找需删除的集合。
timeout
请求超时时间。
单位:秒。
默认值:VectorDBClient() 接口配置的 timeout 时长。
取值范围:大于等于0。

出参描述

{
'code': 0,
'msg': 'operation success',
'affectedCount': 1
}
参数名
参数含义
affectedCount
影响行数,即为删除集合数量。