Working with Data
Schema Management
View and manage MongoDB collection schemas
Schema Management
Understand and manage your MongoDB collection schemas with MongoDash's schema analysis tools.
Schema Detection
MongoDash automatically analyzes your collections to detect schema patterns:
- Field types - Data types for each field
- Nullable fields - Fields that appear in some but not all documents
- Array types - Element types within arrays
- Nested objects - Structure of embedded documents
Schema View
View the detected schema for any collection:
- Open a collection in the Data Explorer
- Click the Schema tab
- View all fields and their types
Field Information
For each field, see:
- Name - Field path (including nested fields)
- Type - MongoDB BSON type
- Coverage - Percentage of documents with this field
- Sample values - Example values from the collection
Schema detection samples up to 10,000 documents. Very large collections may show partial schema.
Schema Validation
BusinessConfigure JSON Schema validation rules to enforce data quality:
Creating Validation Rules
{
"$jsonSchema": {
"bsonType": "object",
"required": ["name", "email"],
"properties": {
"name": {
"bsonType": "string",
"description": "User's full name"
},
"email": {
"bsonType": "string",
"pattern": "^.+@.+$"
},
"age": {
"bsonType": "int",
"minimum": 0,
"maximum": 150
}
}
}
}
Validation Levels
- Strict - Reject invalid documents
- Moderate - Warn but allow invalid documents
Schema Changes
Tracking Schema Evolution
MongoDash tracks schema changes over time:
- New fields added
- Field types changed
- Fields removed
Access schema history from the Schema tab.
Schema Migration
When making schema changes:
- Test changes on a copy collection first
- Document the migration plan
- Apply incrementally with validation
- Monitor for validation errors
Schema validation is applied to new inserts and updates. Existing documents remain unchanged.