Clever Tagline
CCConvex Community
•Created by Michael on 4/5/2025 in #support-community
How to best model an eventually complete record in the schema?
The common way to model such a table is by using
v.optional()
to wrap those field values that don't need to be specified at creation; e.g.
When inserting the document, you're only required to pass values for createdBy
and displayName
. The others you can pass later in mutations via ctx.db.patch
, either singly or at the same time, however your logic needs to work. If passed, only the type you specified will be accepted in each case, or undefined
to delete the existing field value.3 replies
CCConvex Community
•Created by Clever Tagline on 3/28/2025 in #support-community
Paginated indexed query with multiple index choices?
@Lee Just discovered that using
.withSearchIndex
on a stream is indicating a type error with the search filter: Parameter 'q' implicitly has an 'any' type.
FWIW, in this particular case it's not a paginated query. I was using my original method of running multiple queries and adding all of the results to an array, but I thought I'd try to optimize it using streams and ran into this issue.8 replies
CCConvex Community
•Created by Clever Tagline on 3/28/2025 in #support-community
Paginated indexed query with multiple index choices?
Me too. It's working perfectly! Thanks for adding those stream features!
8 replies
CCConvex Community
•Created by Clever Tagline on 3/28/2025 in #support-community
Paginated indexed query with multiple index choices?
I might have just rubberducked this.
While finishing my original post I was thinking, "I wonder if there's a way to merge queries," so I searched the docs for "merge" and found this Stack article: https://stack.convex.dev/merging-streams-of-convex-data
If I'm reading it correctly, I could stream the queries for each region, merge them, then return the pagination of the result. Something like this:
Am I interpreting that correctly?
8 replies
CCConvex Community
•Created by AlphaOmega on 3/21/2025 in #support-community
Why no unions as function validators?
Gotcha. Curious, what's the use case where this would be used?
14 replies
CCConvex Community
•Created by AlphaOmega on 3/21/2025 in #support-community
Why no unions as function validators?
Could you elaborate? Maybe I'm not understanding what you're referring to. I use unions on occasion inside function argument validators without any issues.
14 replies