Docs Home / Compass / Interact with Your Data / Set Validation Rules

Add Validation Rules

The Validation tab allows you to manage schema validation rules for a collection.

Schema validation ensures that all documents in a collection follow a defined set of rules, such as conforming to a specific shape or only allowing a specified range of values in fields.

For details, see Set Validation Rules for Your Schema.

Steps

1

Add rules

To add a rule, click Add Rule.

Validation view
2

Enter your rules

To enter your rules, edit the start template that appears. For example, you can specify required fields and field types. For details, see JSON Schema Validation.

3

Apply rules

To apply the validation rules, click Apply. To go back, click Cancel.

4

(Optional) Preview sample documents

You can preview sample documents that match your validation rules by clicking Preview documents.

5

Confirm rules

To confirm applying the validation rules, click Confirm. To go back, click Cancel.

Next Steps

Learn More