Collections hold business-specific data with a schema you define.
#Field types
string (255 chars), text (24,000), integer, number, boolean, date (YYYY-MM-DD), datetime (UTC ISO with milliseconds), json, enum (with values) and reference (with a target: a native plural such as customers, or a collection name). Fields take optional required, default and unique.
#Create, query, update
TypeScriptawait yasad.collections.create({ name: 'recipes', fields: {name: { type: 'string', required: true }, flourGrams: { type: 'number', default: 500 },}});const loaf = await yasad.data.create('recipes', { name: 'Country sourdough' }, crypto.randomUUID());const { records } = await yasad.data.query('recipes', { filter: { flourGrams: 500 }, sort: 'name', limit: 50 });await yasad.data.update(loaf.id, { revision: loaf.revision, data: { ...loaf.data, flourGrams: 510 } });
Schema changes (PATCH /v1/collections) send the complete new field map with the current version; add optional fields or broaden enums. Existing field types and targets stay fixed. POST /v1/data/summary counts records and summarises a numeric field as decimal strings.