Jacob KimJ
Convex Community17mo ago
18 replies
Jacob Kim

neq condition for `withIndex`

here are pseudocodes that fails to compile:
ctx.db
  .query('inventory')
  .withIndex('by_status', (q) => q.neq('status', 'removed')) // in_stock, sold, removed


ctx.db
  .query('inventory')
  .withIndex('by_status', (q) => q.or(q.eq('status', 'sold'), q.eq('status', 'in_stock')))

both neq and or are not supported with withIndex() how can I do something like above pseudocode?
Was this page helpful?