Skip to content

bug: filtering on boolean columns #1303

Description

@kevin-dp

Tanstack DB currently doesn't support boolean columns as filters. We often end up having to write filters like this:

const { data: products } = useLiveQuery(q =>
    q.from({ product: productCollection })
      .where(({ product }) => product.in_stock)  // Use computed field
      .where(({ product }) => eq(product.in_stock, true))
)

This isn't idiomatic since product.in_stock is already a boolean so we should be able to just write where(({ product }) => product.in_stock). And similarly we often end up writing negations as eq(product.in_stock, false) instead of the more idiomatic not(product.in_stock).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions