O-LoveO
Convex Community11mo ago
5 replies
O-Love

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']),
});
Was this page helpful?