zamis 5 years ago
parent
commit
71f9a74a94
1 changed files with 3 additions and 5 deletions
  1. 3 5
      src/server/service/attachment.js

+ 3 - 5
src/server/service/attachment.js

@@ -45,15 +45,13 @@ class AttachmentService {
 
 
   async removeAttachment(attachments) {
   async removeAttachment(attachments) {
     const { fileUploadService } = this.crowi;
     const { fileUploadService } = this.crowi;
-    const attachmentsCollection = mongoose.connection.collection('attachments');
-    const unorderAttachmentsBulkOp = attachmentsCollection.initializeUnorderedBulkOp();
 
 
     attachments.forEach((attachment) => {
     attachments.forEach((attachment) => {
-      fileUploadService.deleteFile(attachment);
-      unorderAttachmentsBulkOp.find({ _id: attachment._id }).remove();
+      fileUploadService.deleteFiles(attachment);
+      attachment.find({ _id: attachment._id }).remove();
     });
     });
 
 
-    return unorderAttachmentsBulkOp.execute();
+    return;
   }
   }
 
 
 }
 }