Преглед изворни кода

add selection of certain fields with populate

yuto-o пре 4 година
родитељ
комит
81c1c567a9
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      packages/app/src/server/models/revision.js

+ 1 - 1
packages/app/src/server/models/revision.js

@@ -91,7 +91,7 @@ module.exports = function(crowi) {
   };
   };
 
 
   revisionSchema.statics.findLatestRevisionByPathPopulatedWithAuthor = async function(path) {
   revisionSchema.statics.findLatestRevisionByPathPopulatedWithAuthor = async function(path) {
-    return (await this.find({ path }).sort({ createdAt: -1 }).limit(1).populate('author'))[0];
+    return (await this.find({ path }).sort({ createdAt: -1 }).limit(1).populate('author', 'name createdAt imageUrlCached'))[0];
   };
   };
 
 
   return mongoose.model('Revision', revisionSchema);
   return mongoose.model('Revision', revisionSchema);