Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to overcome the array-contain's 10 max limit #139

Open
rodbs opened this issue Dec 20, 2021 · 0 comments
Open

How to overcome the array-contain's 10 max limit #139

rodbs opened this issue Dec 20, 2021 · 0 comments

Comments

@rodbs
Copy link

rodbs commented Dec 20, 2021

To overcome the array-contain's 10 max limit, would it be possible to implement a kind of pagination?

My uses case is that I want to pre-filter the collection before doing an actual filtering. I have a 'items' collection, and each user has myFavItems. I want each user to do be able to filter the 'items' collection but only for his/her items. Example: For user A, it has 20 entries in his myFavItems. I want to go against the 'items' collection and filter by 'blue' items, but only within the scope of his 20 items.

So ideally I'd like to do something like:

const myFavItems = [ 1,2, ... 20] 

const { data  } = useCollection(    'items',
   {
     where: ['id', 'in', myFavItems ]
     where: ['color', 'array-contains', myColor],
 
   },

The problem is the first filter is limited to 10.

So, any ideas? What about to create a moving window to query for 10 items each time?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant