oferitzO
Convex Community2y ago
7 replies
oferitz

How would you perform a "contains" query

How would you perform a "contains" query as opposed to querying by a single id, meaning that the classic query will filter by a single id with the eq operator, for example:
export const findItemsByCategory = query({
  args: { catgoryId: v.id('category') },
  handler: async ({ db }, { catgoryId }) => {
    return getManyFrom(db, 'items', 'by_catgoryId', catgoryId)
  }
})


But what if I want to filter by multiple category ids: ['cat1', 'cat2', ...]? How do I approach it in an efficient manner?
Was this page helpful?