xpriori's Thread
I'm in a lookout for an example of query + filter function. I can't seem to nail it. I'm currently collecting all my users then run a filter by email on the client. 😂
6 Replies
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. If this is a support-related question, please create a post in #support-community. If not, carry on! Thanks!
What kind of filter do you want? You mentioned email, so are you just trying to find the user document with the matching email, or is it something else?
just like that, passing array of emails as args
You can move whatever filtering you’re doing on the client right into your query for starters
I currently have that setup. But somewhere in the official docs, the built-in filter is faster that js filter and that's really what i'm trying to accomplish.
If you have an array of email assesses, index your users table on the email field and loop over the array. Something like:
Filtering alone requires a full table scan. Here we use an index and the unique method, so each db call is scanning 0 or 1 records max, and we’re running the queries in parallel via Promise.all.