alixi
alixi
CCConvex Community
Created by Mordsith on 4/16/2025 in #support-community
Add a query filter for empty value
you could write your own helper for this, something like:
const isEmpty = (q, field) =>
q.or(
q.eq(q.field(field), undefined),
q.eq(q.field(field), null),
// etc
);

await ctx.db
.query('users')
.filter(q => isEmpty(q, 'shouldDeleteAt'))
.collect();
const isEmpty = (q, field) =>
q.or(
q.eq(q.field(field), undefined),
q.eq(q.field(field), null),
// etc
);

await ctx.db
.query('users')
.filter(q => isEmpty(q, 'shouldDeleteAt'))
.collect();
2 replies
CCConvex Community
Created by Rune Darkfire on 9/10/2024 in #support-community
How to return a custom list with extra key-value pair(s)?
You can also write it as a for loop (which I slightly prefer since it's more legible):
for (const assessment of assessments) {
assessmentsWithVendorNames.push({ ...assessment, vendorName: await getVendorName(ctx, assessment.vendorId ?? null) });
}
for (const assessment of assessments) {
assessmentsWithVendorNames.push({ ...assessment, vendorName: await getVendorName(ctx, assessment.vendorId ?? null) });
}
6 replies
CCConvex Community
Created by Rune Darkfire on 9/10/2024 in #support-community
How to return a custom list with extra key-value pair(s)?
which will wait for all the subqueries to finish executing
6 replies
CCConvex Community
Created by Rune Darkfire on 9/10/2024 in #support-community
How to return a custom list with extra key-value pair(s)?
You can rewrite the forEach as
await Promise.all(assessments.map(async (assessment) => {
assessmentsWithVendorNames.push({ ...assessment, vendorName: await getVendorName(ctx, assessment.vendorId ?? null) })
}))
await Promise.all(assessments.map(async (assessment) => {
assessmentsWithVendorNames.push({ ...assessment, vendorName: await getVendorName(ctx, assessment.vendorId ?? null) })
}))
6 replies
CCConvex Community
Created by Rune Darkfire on 9/10/2024 in #support-community
How to return a custom list with extra key-value pair(s)?
It looks like the listWithVendorNames handler might be returning assessmentsWithVendorNames before any of the async functions execute
6 replies
CCConvex Community
Created by djbalin on 9/4/2024 in #general
Hey y'all, does anybody know if there
ah i see! i will update the README with a description of mermaid and an example diagram
6 replies
CCConvex Community
Created by djbalin on 9/4/2024 in #general
Hey y'all, does anybody know if there
yep, the library will show v.id relationships. you can paste the outputted mermaid code into https://mermaid.live/ to see the diagram.
6 replies
CCConvex Community
Created by djbalin on 9/4/2024 in #general
Hey y'all, does anybody know if there
hey! i’m the author of the package. i agree that it starts to look confusing if you have a large schema with arrays and unions. do you think outputting a mermaid erDiagram would be more clear? would love to hear any feedback you have!
6 replies