| Create collection | createCollection(queryCollectionOptions({...})) | Define typed set of objects with getKey |
| Live query (React) | useLiveQuery((q) => q.from({...}).where(...)) | Auto-updates when underlying data changes |
| Filter | .where(({ t }) => eq(t.field, value)) | Supports eq, gt, lt, like, and, or, not |
| Select fields | .select(({ t }) => ({ id: t.id, name: t.name })) | Project specific fields from collections |
| Order results | .orderBy(({ t }) => t.field, 'asc') | Sort ascending or descending |
| Join collections | .join({ b: collB }, ({ a, b }) => eq(...), 'inner') | Cross-collection joins with type safety |
| Group and aggregate | .groupBy(...).select(({ t }) => ({ count: count(t.id) })) | Supports count, sum, avg, min, max |
| Insert | collection.insert({ ...data }) | Optimistic insert, syncs via onInsert handler |
| Update | collection.update(key, (draft) => { ... }) | Immer-style draft mutation, syncs via onUpdate |
| Delete | collection.delete(key) | Optimistic delete, syncs via onDelete handler |
| Electric sync | electricCollectionOptions({ shapeOptions: {...} }) | Real-time Postgres sync via ElectricSQL |
| Live query coll. | liveQueryCollectionOptions({ query }) | Derived collection from live query definition |
| Local storage | localStorageCollectionOptions({...}) |