Schema Validation
$jsonSchema enforces shape.
Example
db.createCollection("users", {
validator: { $jsonSchema: {
required: ["name"],
properties: { name: { bsonType: "string" } }
} }
})Exercise
Validator key.
{ : {} }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.