zamis 5 лет назад
Родитель
Сommit
fc86ded12a
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      src/server/service/file-uploader/gridfs.js

+ 3 - 3
src/server/service/file-uploader/gridfs.js

@@ -47,9 +47,9 @@ module.exports = function(crowi) {
     const filenameValues = attachments.map((attachment) => {
     const filenameValues = attachments.map((attachment) => {
       return attachment.fileName;
       return attachment.fileName;
     });
     });
-
-    const fileIds = await AttachmentFile.find({ filename: { $in: filenameValues } }, { _id: 1 });
-    const idsRelatedFiles = fileIds.map((file) => { return file._id });
+    const idsRelatedFiles = await AttachmentFile.find({ filename: { $in: filenameValues } }, { _id: 1 }).map((responses) => {
+      return responses.map((response) => { return response._id });
+    });
 
 
     await AttachmentFile.find({ filename: { $in: filenameValues } }).remove();
     await AttachmentFile.find({ filename: { $in: filenameValues } }).remove();
     await chunkCollection.deleteMany({ files_id: { $in: idsRelatedFiles } });
     await chunkCollection.deleteMany({ files_id: { $in: idsRelatedFiles } });