|
|
@@ -404,7 +404,10 @@ module.exports = function(crowi) {
|
|
|
//.sort({createdAt: -1}) // TODO optionize
|
|
|
.skip(offset)
|
|
|
.limit(limit)
|
|
|
- .populate('revision')
|
|
|
+ .populate([
|
|
|
+ {path: 'creator', model: 'User'},
|
|
|
+ {path: 'revision', model: 'Revision'},
|
|
|
+ ])
|
|
|
.exec(function(err, pages) {
|
|
|
if (err) {
|
|
|
return reject(err);
|
|
|
@@ -448,6 +451,28 @@ module.exports = function(crowi) {
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Bulk get (for internal only)
|
|
|
+ */
|
|
|
+ pageSchema.statics.getStreamOfFindAll = function(options) {
|
|
|
+ var Page = this
|
|
|
+ , options = options || {}
|
|
|
+ , publicOnly = options.publicOnly || true
|
|
|
+ , criteria = {redirectTo: null,}
|
|
|
+ ;
|
|
|
+
|
|
|
+ if (publicOnly) {
|
|
|
+ criteria.grant = GRANT_PUBLIC;
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.find(criteria)
|
|
|
+ .populate([
|
|
|
+ {path: 'creator', model: 'User'},
|
|
|
+ {path: 'revision', model: 'Revision'},
|
|
|
+ ])
|
|
|
+ .sort({updatedAt: -1})
|
|
|
+ .stream();
|
|
|
};
|
|
|
|
|
|
pageSchema.statics.findListByStartWith = function(path, userData, option) {
|