Here I am again dealing with this. I am sorry if I am being persistent but I believe I am getting close to the solution. I went ahead to try several things and check with the developer console and this is the situation:
-
The closer I have gotten to the desire result is when I use the query:
where("categories","array-contains-any",[$slot("ds_Filter")])
With that, both pickers I have placed (one for level and one for music style) are working. The problem is that it shows all elements/documents that contains any of the values, and what I want is to show just documents with both values in the array. So I guessed I have to change âarray-contains-anyâ for âarray-containsâ.
-
When I change for âarray-containsâ, it doesnât work leaving the query as before. I need to remove the brackets around $slot(âds_Filterâ). Because if I leave it like this:
where("categories","array-contains",[$slot("ds_Filter")])
When I pick the first value, the console shows me:
loading firebase data for âarreglosâ with query: where(âcategoriesâ,
âarray-containsâ,
[âPrincipianteâ]
)
And no document appears. Obviously, it doesnât show anything either when I pick a second value in the other picker:
loading firebase data for âarreglosâ with query: where(âcategoriesâ,
âarray-containsâ,
[âPrincipianteâ,âPop/Rockâ]
)
So I assumed the problem was the brackets. I removed them and now the first picker works, but not the second one. So now my query is like this:
where("categories","array-contains",$slot("ds_Filter"))
When I select a value in the first filter, it shows all elements with that value in the âcategoriesâ array. It works. But when I select another value from the second picker, the console gives me an error:
** error creating firebase query object from âwhere(âcategoriesâ,
âarray-containsâ,
âPrincipianteâ,âPop/Rockâ
)â: FirebaseError: Function Query.where() requires 3 arguments, but was called with 4 arguments.
So, how can I make it to make it work the way I want? if I select a value in the first picker, it shows all elements with that in the array. If I select another value in the second picker, it must show all documents with both values in the array.
Thank you.