Skip to content

Commit

Permalink
delete if multiple documents exist
Browse files Browse the repository at this point in the history
  • Loading branch information
subinps committed Jan 20, 2022
1 parent ab2fbbb commit 285a00b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ async def delete(bot, message):
await msg.edit('File is successfully deleted from database')
else:
file_name = re.sub(r"(_|\-|\.|\+)", " ", str(media.file_name))
result = await Media.collection.delete_one({
result = await Media.collection.delete_many({
'file_name': file_name,
'file_size': media.file_size,
'mime_type': media.mime_type
Expand All @@ -317,7 +317,7 @@ async def delete(bot, message):
else:
# files indexed before https://github.com/EvamariaTG/EvaMaria/commit/f3d2a1bcb155faf44178e5d7a685a1b533e714bf#diff-86b613edf1748372103e94cacff3b578b36b698ef9c16817bb98fe9ef22fb669R39
# have original file name.
result = await Media.collection.delete_one({
result = await Media.collection.delete_many({
'file_name': media.file_name,
'file_size': media.file_size,
'mime_type': media.mime_type
Expand Down

0 comments on commit 285a00b

Please sign in to comment.