COLLECTION()function
COLLECTION(name: K, id: Schema<I>, data: Schemas<T> | DataSchema<T>): Collection<K, I, T>
| Param | Type | |
|---|---|---|
name | K | Collection name used as the table/collection key. required |
id | Schema<I> | Schema for the identifier type. required |
data | Schemas<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 }>