O-Love
O-Love•2mo ago

joi

Hello, I'm playing around with Convex and so far I love it. I'm trying to do something pretty simple but after a few hours I'm still not succesful. Perhaps I'm doing things totally wrong... My schema look like this and I'm just trying to query all the faqs joined with the categories for the name but I can't get my head around this. Could anyone point me in the right direction? I've tried it with withIndex and also had a look at some convex helpers.
export default defineSchema({
categories: defineTable({
name: v.union(
v.literal('general'),
v.literal('forum'),
v.literal('financial'),
v.literal('support'),
),
}),

faqs: defineTable({
question: v.string(),
answer: v.string(),
categoryId: v.id('categories'),
}).index('by_category_id', ['categoryId']),
});
export default defineSchema({
categories: defineTable({
name: v.union(
v.literal('general'),
v.literal('forum'),
v.literal('financial'),
v.literal('support'),
),
}),

faqs: defineTable({
question: v.string(),
answer: v.string(),
categoryId: v.id('categories'),
}).index('by_category_id', ['categoryId']),
});
4 Replies
Convex Bot
Convex Bot•2mo 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!
lee
lee•2mo ago
To generate code from a schema, i would start by asking @kapa.ai , then seeing how close it gets you to a working solution (in the #ask-ai channel. I was hoping that tagging it here would work)
O-Love
O-LoveOP•2mo ago
@Lee thanks, that kinda helped me out. kapa.ai seems smarter then github copilot 😉
lee
lee•2mo ago
For sure. If you have further questions feel free to ask here. And if you're doing ai-codegen check out https://docs.convex.dev/ai
AI Code Generation | Convex Developer Hub
Convex is designed around a small set of composable abstractions with strong

Did you find this page helpful?