hagopj13 / hagopj13/node-express-boilerplate

Help needed with aggregation and pagination

Open
#212 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

I am new to mongodb. This works for me:

``` javascript
const queryCallsByUserId = async (filter, options) => {
const results = await Call.aggregate([
{ $lookup: { from: 'patients', localField: 'patientId', foreignField: '_id', as: 'patientDetails' } },
]);
return results;
};
```

However, I don't get any fields related to pagination.

If I use only `Call.paginate()`, it returns results with pagination. But I don't know how to have paginate working after performing the above aggregation.
Thanks.

Contributor guide

Open the contributing guide

Research direction

Start with the Call.aggregate pipeline and compare it with the existing Call.paginate() entry point. Determine how the repository currently represents paginated results, then verify that aggregation results expose equivalent pagination fields and that the existing API behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript, mongodb, node.js
Domain
api, backend, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.