Reputation: 109
I am trying to filter all data from current user with array-contains, is it possible to use a wildcard or something like ( 1 || 2 || 3 || 4 ... )?
Data:
[{c: 7, i: 2}, {c: 10, i: 2}, {c: 2, i: 1}, {c: 3, i: 2}]
The current c (class) doesn't matter in this search:
.where('admins', 'array-contains', {c: *, i: 1} )
Thanks!
Upvotes: 0
Views: 1211
Reputation: 317497
There is no form of wildcard matching for any Firestore queries. All matching values must be exact. You should structure your data to suit the queries you wish to perform. In your example here, you should have a dedicated field just for values of i
, and query against that field to find documents that have a particular value for i
in the array.
Upvotes: 1