Dhruv Kumar Jha
Dhruv Kumar Jha9mo ago

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
lee
lee9mo ago
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.
Dhruv Kumar Jha
Dhruv Kumar JhaOP9mo ago
Great. Thank you @Lee 🙏

Did you find this page helpful?