Skip to main content

Declaring Models

A schema defines all the fields that make up the document in a collection. Tigris follows the schema as per the JSON schema specification.

Every schema has three required keywords which are expressed as JSON keys:

  • title: This keyword states the name of the collection.
  • description: This keyword states the purpose of the collection.
  • properties: This keyword states the fields that make up the document stored in the collection.


Using these keywords the schema specification of the collection is as follows:

"title": string,
"description": string,
"properties": {
"field": {
"type": integer|number|string|boolean|array|object,
"format": int32|float|byte|uuid|date-time,
"autoGenerate": boolean
"description": string
"primary_key": ["field"]

Defining the properties

The fields must all have the following keywords expressed as JSON keys:

  • type: This keyword states the data type
  • description: This keyword describes the purpose of the field

For certain data types, the fields can optionally have autoGenerate JSON key which specifies that the values for the field are automatically generated by Tigris.

Example Schema

Using the above specification, to model a collection catalog that has id, name, price, brand, labels, popularity field and the id field is set as auto generated.

"title": "catalog",
"properties": {
"id": {
"description": "A unique identifier for the product",
"type": "integer",
"autoGenerate": true
"name": {
"description": "Name of the product",
"type": "string",
"maxLength": 128
"price": {
"description": "Price of the product",
"type": "number"
"brand": {
"description": "The brand of the product",
"type": "string"
"labels": {
"description": "Labeling of the product",
"type": "string"
"popularity": {
"description": "Popularity score of the product",
"type": "integer"
"primary_key": ["id"]

Collection Names

The name of the collection is the title specified in the schema definition. In the example above, the name of the collection is catalog.

Field Names

The field names are the keys inside the properties section of the schema. In the example above, the fields are id, name, price, brand, labels, and popularity.