Generate MongoDB schema designs with indexes, validation, and aggregation pipelines
Create MongoDB schema design for:
Application Type: {{APPLICATION_TYPE}}
Collections Needed: {{COLLECTIONS}}
Query Patterns: {{QUERY_PATTERNS}}
Data Volume: {{EXPECTED_VOLUME}}
Generate complete MongoDB setup:
1. **Collection Schemas:**
- Document structure
- Field types
- Required fields
- Default values
- Embedded vs referenced documents
2. **JSON Schema Validation:**
- Validation rules
- Custom validators
- Error messages
3. **Index Strategy:**
- Single field indexes
- Compound indexes
- Text indexes
- Geospatial indexes
- TTL indexes
- Partial indexes
- Index intersection analysis
4. **Mongoose Models (if applicable):**
- Schema definitions
- Virtual fields
- Instance methods
- Static methods
- Middleware/hooks
- Plugins
5. **Aggregation Pipelines:**
- Common query pipelines
- Reporting aggregations
- Lookup/join patterns
- Performance optimization
6. **Migration Scripts:**
- Schema versioning
- Data transformation
- Index creation
- Rollback procedures
7. **Seed Data:**
- Test data generation
- Faker.js integration
- Bulk insert scripts
8. **Performance Considerations:**
- Sharding key selection
- Read/write concerns
- Connection pooling
- Query optimization
Include explain plan analysis for critical queries.Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{APPLICATION_TYPE][{COLLECTIONS][{QUERY_PATTERNS][{EXPECTED_VOLUME]