Array includes
Is there any way to filter data based on array includes?
Example: I have a query that takes in userId param and I have a collection "userMessages" with field "users" which is array of userIds
How can I filter the data based on users.includes(userId)?
Are there any code examples for this?
2 Replies
This use-case has several solutions, listed here https://stack.convex.dev/complex-filters-in-convex
Using TypeScript to Write Complex Query Filters
There’s a new Convex helper to perform generic TypeScript filters, with the same performance as built-in Convex filters, and unlimited potential.
Great. Thank you @Lee 🙏