zoomie | TuloZ
Convex Community11mo ago
5 replies
zoomie | Tulo

Can't apply multiple bounds (filters) on an index

For the table I'm filtering, I don't know how many results I will get back. I don't want to use collect (in case it crashes) and if I use take, their is a chance all the data returned will be filtered out and the user won't see anything.

I thought I'd add all the filter options into the index, but get an error.

// transaction.ts
    .withIndex("by_project_id_and_block_timestamp_and_value_quote", (q) =>
        q
          .eq("project_id", projectId)
          .gte("block_timestamp", startDate)
          .lte("block_timestamp", endDate)
          .gte("value_quote", minAmount)
      )

// schema.ts
.index("by_project_id_and_block_timestamp_and_value_quote", [
  "project_id",
  "block_timestamp",
   "value_quote",
])

Error: Property 'gte' does not exist on type 'IndexRange'.

Is their a way to use an and? It looks like you can only apply one
UpperBoundIndexRangeBuilder and LowerBoundIndexRangeBuilder
Was this page helpful?