Skip to content

Commit

Permalink
[FEATURE]: add populate feature to paginate plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Behzad-rabiei committed Dec 1, 2023
1 parent d37a9e8 commit 603dc87
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/models/schemas/plugins/pagintae.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ function paginate(schema: any) {
sort = '-createdAt';
}

if (options.populate) {
options.populate.split(',').forEach((populateOption: string) => {
docsPromise = docsPromise.populate(
populateOption
.split('.')
.reverse()
.reduce((a: any, b: string) => ({ path: b, populate: a }), {}),
);
});
}

const countPromise = this.countDocuments(filter).exec();
let docsPromise = this.find(filter).sort(sort).skip(skip).limit(limit);

Expand Down

0 comments on commit 603dc87

Please sign in to comment.