Open florian-baumann opened 3 years ago
Tutorial.paginate(condition, { offset, limit }) .then((data) => { res.send({ totalItems: data.totalDocs, tutorials: data.docs, totalPages: data.totalPages, currentPage: data.page - 1, }); }) .catch((err) => { res.status(500).send({ message: err.message || "Some error occurred while retrieving tutorials.", }); });
aggregation pipelinging https://dev.to/tushark1/mongodb-aggregation-pipeline-stages-to-the-rescue-11am https://dzone.com/articles/mongodb-pipelines-with-examples
not: