Schema Validation
noun
say it: “SKEE-muh val-ih-DAY-shun” /ˈskimə ˌvælɪˈdeɪʃən/
Rules on a MongoDB collection that make it refuse documents that are missing required fields or hold the wrong kind of value.
What is Schema Validation?
Schema validation makes MongoDB reject documents that break rules you define with JSON Schema, such as required fields or types.
db.createCollection('recipes', { validator: { $jsonSchema: { required: ['title'], properties: { minutes: { bsonType: 'int', minimum: 1 } } } } })
In a sentence
- “Schema validation stopped a product from being saved without a price.”
- “With schema validation, the error names the rule the document broke.”
Level: Journeyman · More MongoDB terms at this level
Updated