Kurounin / Pagination

This package allows you to paginate the subscriptions over meteor's collections. It can be used in a Blaze template or in ReactJS.
MIT License
56 stars 22 forks source link

Sort by a new field #81

Closed boboci9 closed 6 years ago

boboci9 commented 6 years ago

Hi,

First of all let me start by telling your package is amazing I am using it in several of my projects.

I am wondering if it is possible the following. In my new project I need to sort the last seen section by the date the current user last seen the product. The pagination is on the products collection and doesn't contain this information, this information has to be taken from the current user's profile based on the id of the product.

Can you help me out on how to implement this sorting with your pagination?

Thank you for your help in advance.

Kurounin commented 6 years ago

Hi,

There's no simple solution for what you're trying to do, since mongo is not a relational database so it does not support joins. If you're only interested in showing products already seen by the user, you could select and sort ids from the user profile table and then use another paginator to get the actual product data (similar to the suggestion from https://github.com/Kurounin/Pagination/issues/67#issuecomment-386688024 )