Baris
CCConvex Community
•Created by Baris on 12/28/2024 in #support-community
Undefined values in indexed queries
How are undefined values handled in an indexed query? I need to write a query like this:
.eq(value).eq(undefined).eq(undefined).eq(value)
Do these undefined values impact query performance in negative way, or are they treated the same as other data types in Convex?
3 replies
CCConvex Community
•Created by Baris on 9/29/2024 in #support-community
Turborepo Vercel Deploy Build Command
Hi, I am using the custom build command specified in the documentation when deploying the NextJS project to Vercel:
I will start using Turborepo; what command (or turbo.json configuration) can I use instead that will fulfill the same function? Thank you!
4 replies
CCConvex Community
•Created by Baris on 9/26/2024 in #support-community
How can I get the reason for login/signup failure with Convex auth?
Hi, is there currently a way to get the reason for login/signup failure (e.g., email not found or invalid password) on the client side with Convex auth? Or is this something that will be added in the future? Thank you. 🙏
13 replies
CCConvex Community
•Created by Baris on 8/10/2024 in #support-community
Does withIndex().order().first() scan all documents?
Hi there, I want to use order("desc").first() to get the maximum number from an indexed number column. This table has more than 16k documents. Does ordering scan all the documents?
2 replies
CCConvex Community
•Created by Baris on 7/19/2024 in #support-community
is there a way to retrieve more than 16k items?
I need to filter items from a large table with client-side js. The items don’t have to be reactive or anything; I just need more than 16k items. I guess looping queries is the way to go, but I couldn’t find an example of it.
2 replies
CCConvex Community
•Created by Baris on 7/2/2024 in #support-community
Question about query limits
3 replies
CCConvex Community
•Created by Baris on 7/2/2024 in #support-community
How can I sort a query by a field in the referenced document?
Hi, In one of my tables, there is a field named user_id that holds a user document’s ID, and in the user table, there is a string name field that holds the user’s name.
I want to sort the first table by the referenced user’s name, but this doesn’t seem possible with indexes.
The only thing I could do seems to be fetching all documents and sorting them with JavaScript, but this isn’t feasible because of the 16 k document scan limit. I want to do this with pagination. How can I achieve it?
26 replies
CCConvex Community
•Created by Baris on 6/29/2024 in #support-community
One large query vs. multiple small queries
Hello again! 🙂 I’m curious whether it’s better to make one large query and put everything into an object or to use multiple
useQuery
calls.
I’m creating a table and using a single query function to retrieve rows, columns, cell values, and various things like dropdown selections, returning them as an object. I could also use separate useQuery
calls for each row and cell.
What are the pros and cons between these two approaches? Specifically, I’m interested in the potential for function timeouts and their impact on caching. Thank you.6 replies
CCConvex Community
•Created by Baris on 6/27/2024 in #support-community
Question about race conditions
Hello everyone,
As far as I have read from the documentation, Convex is entirely reactive and prevents race conditions. That's great! In this case, can we say for certain that there will be no race condition in the following scenarios?
Let's say a "like" function will be created, which will create a like document when liked and delete this document when unliked. In this case, the first option is to create a single toggleLike function and check if the document exists with each like and unlike operation, and the second option is to create two functions for like and unlike, and learn whether it is already liked or not based on a previously defined useQuery result before performing a useMutation, and then use the appropriate function accordingly.
Which of these two options guarantees that there will be no race condition, meaning that no extra like document will be accidentally created when multiple people like at the same time? (Assuming they all use the same account)
Thank you in advance for your time 🙏
7 replies
CCConvex Community
•Created by Baris on 6/24/2024 in #support-community
Does using optional fields have a positive impact on database performance?
Hi, I have a table where I can make some fields optional, and it seems that having them unset rather than containing thousands of false values might be beneficial. Is this a good practice, what do you think?
3 replies
CCConvex Community
•Created by Baris on 5/14/2024 in #support-community
How should I handle rate limiting?
What is the best way to create a rate limiting system? Should I build my own system within Convex? Or should I outsource it and use a Redis database like Upstash?
Is there an ongoing default rate limiting feature development? I'm not in a hurry, I can wait. Thanks in advance!
5 replies
CCConvex Community
•Created by Baris on 5/10/2024 in #support-community
Duplicate function calls
23 replies
CCConvex Community
•Created by Baris on 5/9/2024 in #support-community
How can I make my queries more efficient
Hello everyone, first of all, Convex is an excellent backend and we loved it! We're still learning and trying to make queries more efficient and cost effective.
Currently, We have a list that will contain thousands of items, and listing 50 items per page with a single query. But at the same time, each row uses its own useQuery to fetch additional data from a different table.
Isn't it inefficient to use a useQuery for each row since each one counts as a function call? As a solution, Is it possible to return both row and additional data as a merged object or appending additional data to inside the row data like graphql?
7 replies