Collection Management
The Collection Management activity provides a comprehensive interface for creating new MongoDB collections and modifying existing ones. Configure all MongoDB collection options including schema validation, capped settings, time series, views, collation, and advanced features through an intuitive card-based layout.
Get started with collection management in VisuaLeaf:
The Collection Management interface operates in two distinct modes with different available options:
| Mode | Available Options | Indication |
|---|---|---|
Create |
All options available - name, capped, storage engine, views, time series, collation, clustered index, encrypted fields | Header shows "Create Collection" |
Edit |
Limited options - validation rules, validation level/action, TTL, change stream images, comment | Header shows "Modify: [collection name]" with yellow info banner |
The Basic Configuration card contains fundamental collection settings available during creation.
| Field | Description | Required |
|---|---|---|
Collection Name |
Unique name within the database. Shows real-time validation if name already exists. | Yes |
Comment |
Optional description attached to the collection metadata | No |
Capped Collection |
Enable fixed-size collection with automatic document rotation. Click "Configure" to set size/max. | No |
When enabling capped collections, click the "Configure" button to open the Capped Configuration modal:
| Option | Description | Required |
|---|---|---|
Size (bytes) |
Maximum collection size. Required when capped is enabled. | Yes (if capped) |
Max Documents |
Maximum number of documents. Size limit takes precedence. | No |
Enforce data integrity using MongoDB's document validation. This card is available in both Create and Edit modes.
Define validation rules using JSON Schema or MongoDB query expressions. The validator textarea shows real-time JSON validation status:
Two buttons appear next to the validator textarea:
| Level | Behavior |
|---|---|
strict (Default) |
Apply validation to all inserts and updates |
moderate |
Apply validation to inserts and updates on existing valid documents only |
off |
Disable validation entirely |
| Action | Behavior |
|---|---|
error (Default) |
Reject documents that fail validation |
warn |
Accept invalid documents but log validation failures |
{
"$jsonSchema": {
"bsonType": "object",
"required": ["email", "username", "createdAt"],
"properties": {
"email": {
"bsonType": "string",
"pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
"description": "Valid email address required"
},
"username": {
"bsonType": "string",
"minLength": 3,
"maxLength": 50
},
"role": {
"enum": ["user", "admin", "moderator"]
},
"createdAt": {
"bsonType": "date"
}
}
}
}
This card appears only in Create mode and contains options that cannot be changed after collection creation.
Configure WiredTiger storage engine settings. Click the gear icon to open the Storage Engine Configuration modal.
{"wiredTiger": {"configString": "block_compressor=zlib"}}
Set default options applied to all indexes created on this collection. Click the list icon to open the configuration modal.
{"storageEngine": {"wiredTiger": {"configString": "block_compressor=zlib"}}}
Configure language-specific string comparison rules. Click the globe icon to open the Collation Configuration modal.
| Option | Description |
|---|---|
locale |
Language locale (e.g., en_US, fr, de, zh) |
strength |
Comparison level (1-5, affects case/accent sensitivity) |
caseLevel |
Include case in comparison at level 1-2 |
numericOrdering |
Compare numeric strings as numbers |
Configure acknowledgment behavior for the collection creation operation. Click the pen icon to open the Write Concern Configuration modal.
{"w": "majority", "j": true, "wtimeout": 5000}
This card enables creation of MongoDB views and time series collections.
Views are read-only collections that display data from an aggregation pipeline on a source collection.
| Field | Description |
|---|---|
View Source Collection |
The source collection for the view. Select from autocomplete dropdown. |
Aggregation Pipeline |
Array of pipeline stages to transform the source data |
[
{"$match": {"status": "active"}},
{"$project": {"name": 1, "email": 1}}
]
Specialized collections optimized for time-stamped data with automatic bucketing and compression. Click "Configure Time Series" to open the configuration modal.
| Field | Description | Required |
|---|---|---|
timeField |
Field containing the timestamp for each document | Yes |
metaField |
Field containing metadata constant across measurements | No |
granularity |
Time bucket size: seconds, minutes, or hours | No |
This card contains options available in both Create and Edit modes, marked with a green "Available in Edit Mode" badge.
Set automatic document expiration for time series collections. Documents are deleted after the specified number of seconds from their timestamp.
Enable capture of document state before and after changes for change stream consumers. Use the Enable or Disable buttons for quick configuration, or edit the JSON directly.
{"enabled": true}
This card contains specialized MongoDB features for advanced use cases.
Create a collection with documents stored in clustered index order for improved query performance on the clustered key.
{"key": {"_id": 1}, "unique": true}
Configure client-side field level encryption. This feature requires MongoDB Enterprise.
{"fields": [{"path": "ssn", "bsonType": "string", "keyId": "..."}]}
Each field includes a blue question mark icon that opens a detailed help modal with field description, expected data type, example values, and a link to official MongoDB documentation.
The sticky footer contains action buttons:
| Button | Action | State |
|---|---|---|
Cancel |
Closes the activity without saving changes | Always enabled |
Create Collection |
Creates the collection with configured options (Create mode) | Enabled when form is valid |
Apply Changes |
Applies modifications using collMod (Edit mode) | Enabled when form is valid |
The interface provides real-time validation feedback:
After submission, success or error messages appear in a modal dialog indicating the operation result.
Standard Collection - Enter only the collection name and click Create. All other options use MongoDB defaults.
Validated Collection - Configure JSON Schema validation to enforce document structure. Use the visual schema editor for complex schemas.
Logging Collection - Enable Capped Collection, set appropriate size limit, and optionally set max documents for fixed-size log storage.
IoT/Metrics Collection - Configure as Time Series with appropriate timeField, metaField for device ID, and granularity matching your data frequency.
Materialized View - Set View Source Collection and define an aggregation pipeline to create a read-only transformed view of your data.
Internationalized Collection - Configure Collation with appropriate locale for proper text sorting in your application's language.
Download and start managing your MongoDB databases with ease.
Download Free Trial