Fix MongoDB set handling in delete operations
This commit is contained in:
parent
6364d076aa
commit
d512db26e4
1 changed files with 8 additions and 0 deletions
|
|
@ -159,6 +159,10 @@ class MongoKVStorage(BaseKVStorage):
|
||||||
if not ids:
|
if not ids:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Convert to list if it's a set (MongoDB BSON cannot encode sets)
|
||||||
|
if isinstance(ids, set):
|
||||||
|
ids = list(ids)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = await self._data.delete_many({"_id": {"$in": ids}})
|
result = await self._data.delete_many({"_id": {"$in": ids}})
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|
@ -1044,6 +1048,10 @@ class MongoVectorDBStorage(BaseVectorStorage):
|
||||||
if not ids:
|
if not ids:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Convert to list if it's a set (MongoDB BSON cannot encode sets)
|
||||||
|
if isinstance(ids, set):
|
||||||
|
ids = list(ids)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = await self._data.delete_many({"_id": {"$in": ids}})
|
result = await self._data.delete_many({"_id": {"$in": ids}})
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue