# Custom Data

Custom Data Types allow the definition of custom types. The data of such a type is stored as JSON by FYLR.

All custom data is stored in its own table in FYLR, each record is stored only once per `_uuid`. The `_uuid` can be provided or will be auto-generated by FYLR based on the data which was sent. If that data changes a new UUID is generated and a new record is stored. The old record is kept in the database as long as it is references by any object (including historical versions).

## Providing UUID

Custom data can contain a `_uuid` at the top level of the data. With such an id FYLR is not generating one.

> Record uniqueness is determined soley on the provided UUID. So sending different data with the same UUID will not update the stored data. To update the stored data, a new UUID must be provided.

## Search

Custom Data Types support search mappings. The search mapping is defined in the `manifest.yml` of the plugin which defines the Custom Data Type.

## Updates

Custom Data Types can be updated by a background service provided by FYLR. This background service collects all expired custom data and asks a script of the plugin to provide any updates on that data as needed. The updates happen periodically and the Custom Data Type can provide an expiration date for each record.
