COLLECTION()function

COLLECTION(name: K, id: Schema<I>, data: Schemas<T> | DataSchema<T>): Collection<K, I, T>
ParamType
nameK
Collection name used as the table/collection key. required
idSchema<I>
Schema for the identifier type. required
dataSchemas<T>
DataSchema<T>
Data schema, or the Schemas props used to construct one. required
Return
Collection<K, I, T>
Declarative definition of a database collection/table.

Create a Collection from a name, an identifier schema, and a data schema.

Factory for Collection.

Examples

COLLECTION("users", ID, { name: STRING, age: NUMBER }) // Collection<"users", number, { name: string; age: number }>