Hmza
Hmza7mo ago

`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
Hmza
HmzaOP7mo ago
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. @public
i know it returns an expression
lee
lee7mo ago
FilterBuilder is compiled into Rust, so it cannot run arbitrary javascript/typescript
Hmza
HmzaOP7mo ago
and this isn't how it suppose to be. but still playing my odds
lee
lee7mo ago
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.
Hmza
HmzaOP7mo ago
hey lee hope you doing good. yeah i'll move to it. should've when you first suggested for query builder thanks
lee
lee7mo ago
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

Did you find this page helpful?