Skip to content

VexWhere

VexWhere<S> = ((q) => ConstraintResult) | VexWhereNode<S>

Defined in: packages/core/src/db/queryArgs.ts:112

The where argument of find and search: a predicate over S’s fields, as EITHER a builder callback or its plain VexWhereNode equivalent. Both compile to the same filter (whereToConvexQueryFilter); the plain form exists for a filter that must be saved or cross the network — a builder callback cannot.

The callback form is the same one an access rule’s q.where(...) receives. On Convex both compile to .filter(...), which scans the narrowed range — prefer withIndex for anything an index can express.

S extends string

Collection slug.

find({ ctx, collection: "posts", where: (q) => q.and(q.eq("featured", true), q.neq("slug", "hidden")) })
find({ ctx, collection: "posts", where: { and: [{ field: "featured", op: "eq", value: true }, { field: "slug", op: "neq", value: "hidden" }] } })