zamis 5 years ago
parent
commit
7422a37b87
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/server/service/file-uploader/gridfs.js

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

@@ -53,8 +53,9 @@ module.exports = function(crowi) {
       return;
       return;
     });
     });
 
 
-    const files = await AttachmentFile.find({ filename: { $in: filenameValues } });
-    const idsRelatedFiles = files.map((file) => { return file._id });
+    const fileIds = await AttachmentFile.find({ filename: { $in: filenameValues } }, { _id: 1 });
+    const idsRelatedFiles = fileIds.map((file) => { return file._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 } });