Skip to main content

Type Alias: Schema

Schema = object

Defined in: cfds/base/schema.ts:121

A Schema defines the structure of a Document. Schemas are also versioned, allowing for live, gradual migrations of data for some users, while others continue to work with the old version in parallel.

Properties

PropertyTypeDescriptionDefined in
fieldsSchemaFieldsDefA definition of all fields declared by this schema.cfds/base/schema.ts:135
nsnull | stringThe namespace of this schema. The null and session namespaces are reserved for the GoatDB's use.cfds/base/schema.ts:126
upgrade?(data, schema) => CoreObjectAn optional upgrade function, used to migrate documents from an older schema to this schema. When upgrading a document, upgrade functions are run in order until reaching the latest version available. For example, if a document is at schema v1, and needs to be upgraded to v3, then first the upgrade function of v2 will be run, then the result piped through the upgrade function of v3.cfds/base/schema.ts:154
versionnumberThe version of this schema. Used to detect when a new version of a schema is available.cfds/base/schema.ts:131