# Schema Validation with $jsonSchema

A collection can refuse documents with the wrong shape; a $jsonSchema validator lists the required fields, each field's type, a minimum and the values allowed, createCollection or collMod attaches it, the error names the rule a document broke, and validationLevel and validationAction decide what is checked and what happens.

![Cheat sheet: Schema Validation with $jsonSchema](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/78cfab8fdffb47049ec3a6b683b969c3.webp)

- Category: MongoDB
- Level: Journeyman
- Tags: $jsonSchema, collMod, mongodb, Schema Validation, validationLevel and validationAction
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/mongodb-schema-validation-cheat-sheet
