.createCollection()
Creates a new collection where data will be stored in a separate file.
createCollection(name, defaultValues)
Parameter | Default | Description |
name |
| The name for the collection |
defaultValues | | Data (optional) Default values for omitted keys |
Returns | Description |
The new collection |
With default values:
With incrementable properties:
Incrementable properties were added in the version 2.6.0.
They are used to assign an automatic value to an entry from the collection, incrementing its value when a new entry is inserted into the collection.
To represent an incrementable property, you must put a dollar sign ($
) before the property name and provide its initial value. The dollar sign will not appear in the entry's properties (ex.: $id
will set a property named id
).
Incrementable properties only work with values of type Number.
The Typescript typings for incrementable properties are not yet properly working as of version 2.13.0.
Last updated