'long response time when doing filter and sort query mongoose

I'm facing some performance issues in my app, I'm using mongoose as ODM, and mongoose paginate for pagination, I have over 1M collection and I'm using compound indexes, but there is a huge difference in response time between my app and when I try the same request in mongo compass or robot 3T, so could you guys help me I'm really struggling, I don't what to do about it



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source