Skip to content

Commit

Permalink
Merge branch 'staging' of github.com:dataesr/paysage-api into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
folland87 committed Dec 1, 2022
2 parents ad7db0e + 3c0f4bd commit 1f9a7fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/structures/keynumbers/keynumbers.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function find(req, res, next) {
{ $skip: skip },
];
if (sort) { queryPipeline.push({ $sort: parseSortParams(sort) }); }
queryPipeline.push({ $limit: limit });
if (limit && limit > 0) { queryPipeline.push({ $limit: limit }); }
const data = await db.collection('keynumbers').aggregate([
{ $facet: { data: queryPipeline, total: countPipeline } },
{ $project: { data: 1, total: { $arrayElemAt: ['$total', 0] } } },
Expand Down

0 comments on commit 1f9a7fd

Please sign in to comment.