`q.eq(q.field(field), value)` is there a
q.eq(q.field(field), value)
is there a way to get field value directly ? for example
q.field(field).value or something
? is there a function for that?6 Replies
talking about convex
FilterBuilder
(method) FilterBuilder<GenericTableInfo>.field<any>(fieldPath: any): Expression<Value | undefined> Evaluates to the field at the given fieldPath. For example, in OrderedQuery.filter this can be used to examine the values being filtered. Example On this object: { "user": { "isActive": true } } field("user.isActive") evaluates to true. @publici know it returns an expression
FilterBuilder is compiled into Rust, so it cannot run arbitrary javascript/typescript
and this isn't how it suppose to be. but still playing my odds
If you want the value, use this instead of FilterBuilder https://stack.convex.dev/complex-filters-in-convex
Using TypeScript to Write Complex Query Filters
There’s a new Convex helper to perform generic TypeScript filters, with the same performance as built-in Convex filters, and unlimited potential.
hey lee hope you doing good.
yeah i'll move to it. should've when you first suggested for query builder
thanks
no worries. FilterBuilder is fine for basic stuff, and it can be slightly more efficient. But i would use the helper as soon as you start doing complex things