Skip to main content

Schema validation configuration

This page aims to clarify the scope of settings and configurations related to schema validation.

Settings and configurations scopes

Enabling and disabling validation for the database

Writing validation can be enabled or disabled for the database and per collection.

When validation is enabled for the database, documents are validated when they are written if a schema is defined and enabled for their collection.
When validation is disabled for the database, documents are written without validation regardless of individual collection settings.

  • Learn here how to enable and disable validation for the database using Studio.
  • Learn here how to enable and disable validation for the database via the client API.

Per-collection configuration

Schemas can be defined for collections to ensure that documents are written only if they comply with the defined constraints.

Define and enable a schema for a collection to validate the collection documents as they are written. Validation will take place only if it is also enabled for the database.

  • Learn here how to enable and disable validation for the database using Studio.
  • Learn here how to enable and disable validation for the database via the client API.

Index configuration

Schemas can be defined for audit indexes to validate documents during indexing, store validation error messages in an index field, and can be queried to find documents by their compliance status.

If a schema is not explicitly defined for an audit index, the index will use the schema defined for the collection.

  • Learn here how to define a schema for an audit index using Studio.
  • Learn here how to define a schema for an audit index via the client API.