浏览代码

ensure to set { virtuals: true } to attachment schema

Yuki Takei 7 年之前
父节点
当前提交
b5041e1b7a
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/server/models/attachment.js

+ 4 - 0
src/server/models/attachment.js

@@ -37,6 +37,10 @@ module.exports = function(crowi) {
     return `/download/${this._id}`;
   });
 
+  attachmentSchema.set('toObject', { virtuals: true });
+  attachmentSchema.set('toJSON', { virtuals: true });
+
+
   attachmentSchema.statics.create = async function(pageId, user, fileStream, originalName, fileFormat, fileSize) {
     const Attachment = this;