List methods (listRows, listFiles, list for users and teams…) accept queries: a list built with the Query class. Conditions are combined (logical AND).
import { Query, TablesDB } from '@owbase/web';import { client } from './client';
const db = new TablesDB(client);
const { rows, total } = await db.listRows({ databaseId: 'store', tableId: 'orders', queries: [ Query.equal('status', ['paid', 'shipped']), Query.greaterThan('total', 100), Query.orderDesc('$createdAt'), Query.select(['$id', 'customer', 'total', 'status']), Query.limit(20), ],});console.log(`${rows.length} of ${total} orders`);The most used
Section titled “The most used”| To | Query. |
|---|---|
| equal to one value or to any of several | equal('status', 'paid'), equal('status', ['paid', 'shipped']) |
| not equal | notEqual(column, value) |
| greater, less | greaterThan, greaterThanEqual, lessThan, lessThanEqual |
| range | between('total', 100, 500) |
| text | startsWith, endsWith, contains, search (this one requires a text index) |
| empty or filled | isNull(column), isNotNull(column) |
| OR between conditions | or([Query.equal(…), Query.equal(…)]) |
| sort | orderAsc(column), orderDesc(column) |
| choose columns | select(['$id', 'total']) |
| paginate | limit(n), offset(n), cursorAfter(id) (Pagination) |
Limits and performance
Section titled “Limits and performance”- Up to 100 queries per request, each up to 4096 characters.
- Filtering and sorting on a large table call for an index on the column (Database).
selectshrinks the response: fetch only the columns the screen uses.
Was this page helpful?Thanks for your feedback.