stormblessed
stormblessed3w ago

table value in array when querying

I can’t find a way to check if, say, a number is in an array of numbers when querying the db
7 Replies
Convex Bot
Convex Bot3w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
erquhart
erquhart3w ago
Welcome! You would need to read the records and filter down in javascript/typescript. If you can share more of your use case we can get more specific.
erquhart
erquhart3w ago
Here's an article on complex filters in Typescript: 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.
erquhart
erquhart3w ago
As it mentions, this works fine if you can index down to a small enough subset of records, but if not you'll need to find a way to index. Article has some reference approaches for that as well.
noob saibot
noob saibot3w ago
Thanks for the article. I'll go through it. I understand that the best way is try to narrow down the subset of records with an index. My use case is simple: I have a part of the user name "e.g John S..." (for John Smith) and I would like to find "John Smith". There is nothing else to narrow the subset of users. In this case, should I use a "search Index"?
jamwt
jamwt3w ago
Full Text Search | Convex Developer Hub
Run search queries over your Convex documents
jamwt
jamwt3w ago
for e.g. autocomplete so yeah, your example would work

Did you find this page helpful?