← Reference

Reference

Collections and list()

Collections are the typed entry point for creating, finding, listing, counting, and relating objects.

list()
WhereOrderSelectIncludeCache
Choose compact projected rows or fully hydrated objects intentionally.

Hydrated objects

list(), get(), and related reads normally turn rows into the correct object or STI subclass. Use include to batch-load named relationships without N+1 queries.

Projected rows

list({ select }) validates logical field names and returns precisely typed plain rows. Projection and relationship inclusion are intentionally separate modes.

list-items.ts
typescript
const rows = await items.list({
  select: ['id', 'title', 'status'] as const,
  where: { status: 'open' },
  orderBy: 'created_at DESC',
  limit: 50
});

Tenant and cache behavior

Tenant interceptors run for list, get, count, and related reads. Read caching is opt-in; writes invalidate affected entries, while count always checks the database.