Enforce a Document Schema¶
On this page
- Navigate to the Collection Schema Screen
- Generate a Schema
- Add Field-Level Schema Definitions
- Add Change Validation Expressions
- Save the Schema
- Validate Documents Against the Schema
- Log In to MongoDB Cloud
- Pull the Latest Version of Your App
- Define the Document Schema
- Define Change Validation
- Deploy the Updated Schema
You can control the shape and contents of documents in a collection by defining a document schema. Schemas are regular documents that adhere to the same JSON schema specification as the schema validation built into the core MongoDB server. You can use schemas to control the type of a field's value, require specific fields, and validate changes before committing the results of insert and update operations.
This guide walks through creating a document schema for a collection in a linked MongoDB Atlas cluster.
Data Lake data sources do not support rules. You can only access a Data Lake data source in a system function.